https://github.com/webfactory/document-ready
https://github.com/webfactory/document-ready
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/webfactory/document-ready
- Owner: webfactory
- Created: 2025-08-27T11:36:58.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-27T11:56:42.000Z (10 months ago)
- Last Synced: 2025-08-27T20:15:54.358Z (10 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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();
});
```