MCPcopy Index your code
hub / github.com/processing/p5.js / waitForDocumentReady

Function waitForDocumentReady

src/core/init.js:44–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42
43// make a promise that resolves when the document is ready
44export const waitForDocumentReady = () =>{
45 if(typeof document !== 'undefined'){
46 return new Promise((resolve, reject) => {
47 // if the page is ready, initialize p5 immediately
48 if (document.readyState === 'complete') {
49 resolve();
50 // if the page is still loading, add an event listener
51 // and initialize p5 as soon as it finishes loading
52 } else {
53 window.addEventListener('load', resolve, false);
54 }
55 });
56 }
57};
58
59// only load translations if we're using the full, un-minified library
60export const waitingForTranslator =

Callers 1

app.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected