UNPKG

@blackglory/wait-for

Version:

A module for waiting for things to happen.

10 lines (9 loc) 240 B
export function waitForLoad(): Promise<void> { return new Promise(resolve => { if (document.readyState === 'complete') { resolve() } else { window.addEventListener('load', () => resolve(), { once: true }) } }) }