Every line of '$document loaded' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
75 export function documentReady(cb) { 76 77 if (stateIsInteractive() || stateIsComplete()) { 78 cb(); 79 } 80 81 function loadedHandler() { 82 removeHandler(doc, 'DOMContentLoaded', loadedHandler); 83 cb(); 84 } 85 86 addHandler(doc, 'DOMContentLoaded', loadedHandler); 87 }
43 _documentIsReady() { 44 const readyState = document.readyState; 45 const isScrolling = document.documentElement.doScroll; 46 const isComplete=readyState === 'complete'; 47 const isLoading=readyState === 'loading'; 48 if (isComplete) return true; 49 if ( (!isLoading) && (!isScrolling) ) { 50 return true; 51 } 52 return false; 53 }
236 value: function _documentUpdated() { 237 this._setDocument(null); 238 }
103 public async load() { 104 const { root: dom } = await this._DOM.getDocument({ depth: -1 }); 105 106 this.trackNodes(dom); 107 this._dom = dom; 108 }
56 function loadDocument(documentUrl) { 57 "use strict"; 58 59 if (documentUrl) { 60 var extension = documentUrl.split('.').pop(), 61 Plugin; 62 extension = extension.toLowerCase(); 63 64 switch (extension) { 65 case 'odt': 66 case 'odp': 67 case 'ods': 68 case 'fodt': 69 loadPlugin('./ODFViewerPlugin', function () { 70 Plugin = ODFViewerPlugin; 71 }); 72 break; 73 case 'pdf': 74 loadPlugin('./PDFViewerPlugin', function () { 75 Plugin = PDFViewerPlugin; 76 }); 77 break; 78 } 79 80 window.onload = function () { 81 if (Plugin) { 82 viewer = new Viewer(new Plugin()); 83 } 84 }; 85 } 86 }
139 export function documentReady() { 140 return new Promise((resolve, reject) => { 141 if ( 142 document.readyState === 'interactive' || 143 document.readyState === 'complete' 144 ) 145 resolve() 146 else document.addEventListener('DOMContentLoaded', resolve) 147 }) 148 }