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

3.1.0 • Public • Published

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

import domLoaded from 'dom-loaded';

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.

domLoaded.signal

Type: AbortSignal

An AbortSignal that triggers when the DOM finishes loading or immediately if it has already loaded.

Related

Package Sidebar

Install

npm i dom-loaded

Weekly Downloads

665

Version

3.1.0

License

MIT

Unpacked Size

4.59 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus