diff --git a/src/core/init.js b/src/core/init.js index a6a76a05a8..9cecfca8a8 100644 --- a/src/core/init.js +++ b/src/core/init.js @@ -25,6 +25,9 @@ const _globalInit = () => { } if (!window.mocha) { + const p5ReadyEvent = new Event('p5Ready'); + window.dispatchEvent(p5ReadyEvent); + // If there is a setup or draw function on the window // then instantiate p5 in "global" mode if ( @@ -32,8 +35,6 @@ const _globalInit = () => { (window.draw && typeof window.draw === 'function')) && !p5.instance ) { - const p5ReadyEvent = new Event('p5Ready'); - window.dispatchEvent(p5ReadyEvent); new p5(); } }