9 lines
No EOL
233 B
TypeScript
9 lines
No EOL
233 B
TypeScript
const ready = (loaded: () => void): void => {
|
|
if (['interactive', 'complete'].includes(document.readyState)) {
|
|
loaded();
|
|
} else {
|
|
document.addEventListener('DOMContentLoaded', loaded);
|
|
}
|
|
};
|
|
|
|
export { ready as default }; |