Sha256: ee6e433db77cabc219e8c1ae403ab6582ec6427b63f8491236535ca5ff163bf0
Contents?: true
Size: 492 Bytes
Versions: 3
Compression:
Stored size: 492 Bytes
Contents
type ReadyHandlerFunc = () => void; const readyHandlers: ReadyHandlerFunc[] = []; const handleState = () => { if (["interactive", "complete"].indexOf(document.readyState) > -1) { while(readyHandlers.length > 0) { (readyHandlers.shift())(); } } }; class ReadyHandler { constructor () { document.onreadystatechange = handleState; } ready (handler: ReadyHandlerFunc) { readyHandlers.push(handler); handleState(); } } export default new ReadyHandler();
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.12.4 | app/javascript/lib/readyHandler.ts |
pages_core-3.12.3 | app/javascript/lib/readyHandler.ts |
pages_core-3.12.2 | app/javascript/lib/readyHandler.ts |