promisified-dom-events
TypeScript icon, indicating that this package has built-in type declarations

2.2.2 • Public • Published

Promisified DOM Events

This is a small library which creates promises for some single events: DOMContentLoaded and window.onload. It doesn't matter when you use it before or after events. If an event has happend promise will be fullfilled.

Install

npm install -S promisified-dom-events

Use

// import
import {loaded, ready} from 'promisified-dom-events';
ready.then(() => {
  // DOM is ready
});
loaded.then(() => {
  // window is loaded
});
 
// from a global object
window.promisifiedDomEvents.ready.then(() => {
  // DOM is ready
});
window.promisifiedDomEvents.loaded.then(() => {
  // window is loaded
});
 

Package Sidebar

Install

npm i promisified-dom-events

Weekly Downloads

2

Version

2.2.2

License

ISC

Unpacked Size

4.39 kB

Total Files

5

Last publish

Collaborators

  • drfisher