Check when the DOM has loaded like
DOMContentLoaded
Unlike DOMContentLoaded
, this also works when included after the DOM was loaded.
npm install dom-loaded
import domLoaded from 'dom-loaded';
await domLoaded;
console.log('The DOM is now loaded.');
Type: Promise<void>
The promise resolves when the DOM finishes loading or right away if the DOM has already loaded.
Type: boolean
Synchronously check if the DOM has already finished loading.
Type: AbortSignal
An AbortSignal
that triggers when the DOM finishes loading or immediately if it has already loaded.
- element-ready - Detect when an element is ready in the DOM