An open API service indexing awesome lists of open source software.

https://github.com/webfactory/document-ready


https://github.com/webfactory/document-ready

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# documentReady Utility

The `documentReady` utility is a simple JavaScript function that allows you to execute a callback function once the HTML document has fully loaded. This is particularly useful for ensuring that asynchronously loaded scripts run only after the DOM is ready, preventing potential issues with elements not being available when your code executes.

## Installation

```
npm install @webfactoryde/document-ready
```

## Usage

Import the `documentReady` function in your module(s) and pass a callback:

```javascript
// your module
import documentReady from '@webfactoryde/document-ready';

function init() {
// do stuff
}

documentReady(function() {
init();
});
```