html-ready
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

html-ready test devDependency Status

The promise to ensure window/document is ready.

Install

Using npm:

$ npm install html-ready

Usage

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 | 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.

windowReady: Promise<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.

License

MIT © Shogo Sensui

Readme

Keywords

Package Sidebar

Install

npm i html-ready

Weekly Downloads

18

Version

2.1.0

License

MIT

Unpacked Size

13.1 kB

Total Files

17

Last publish

Collaborators

  • 1000ch