https://github.com/1000ch/html-ready
The promise to ensure window/document is ready.
https://github.com/1000ch/html-ready
document html ready window
Last synced: about 1 year ago
JSON representation
The promise to ensure window/document is ready.
- Host: GitHub
- URL: https://github.com/1000ch/html-ready
- Owner: 1000ch
- License: mit
- Created: 2020-08-02T15:25:29.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-03-05T09:15:47.000Z (about 3 years ago)
- Last Synced: 2025-03-11T10:50:28.678Z (about 1 year ago)
- Topics: document, html, ready, window
- Language: TypeScript
- Homepage: http://npmjs.com/html-ready
- Size: 1.5 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# html-ready 
The promise to ensure window/document is ready.
## Install
Using npm:
```bash
$ npm install html-ready
```
## Usage
```javascript
import { documentReady, windowReady } from 'https://unpkg.com/html-ready';
documentReady.then(() => {
console.log('document DOMContentLoaded event is fired');
});
windowReady.then(() => {
console.log('window load event is fired');
});
```
## API
### documentReady: Promise<[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) | undefined>
`documentReady` is a `Promise` that is resolved if the HTML document has been loaded and parsed. If the hole page has not loaded, the timing is equivalent to [the `DOMContentLoaded` event of document](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event).
### windowReady: Promise<[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) | undefined>
`windowReady` is a `Promise` that is resolved if the hole page has been loaded. If the hole page has not been loaded, the timing is equivalent to [the `load` event of window](https://developer.mozilla.org/docs/Web/API/Window/load_event).
## License
[MIT](https://1000ch.mit-license.org) © [Shogo Sensui](https://github.com/1000ch)