From 5e040f9241d1be3ff700d2ea210c964ccb633bfa Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Wed, 14 Aug 2024 12:58:16 +0100 Subject: [PATCH] Move init event to run even in instance mode --- src/core/init.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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(); } }