dom-loaded

Check when the DOM has loaded like `DOMContentLoaded`


Keywords
browser, dom, document, ready, complete, check, wait, domcontentloaded, readystate
License
MIT
Install
npm install dom-loaded@3.0.0

Documentation

dom-loaded

Check when the DOM has loaded like DOMContentLoaded

Unlike DOMContentLoaded, this also works when included after the DOM was loaded.

Install

$ npm install dom-loaded

Usage

const domLoaded = require('dom-loaded');

(async () => {
	await domLoaded;
	console.log('The DOM is now loaded.');
})();

API

domLoaded

Type: Promise<void>

The promise resolves when the DOM finishes loading or right away if the DOM has already loaded.

domLoaded.hasLoaded

Type: boolean

Synchronously check if the DOM has already finished loading.

Related