Skip to content

Commit

Permalink
Move init event to run even in instance mode
Browse files Browse the repository at this point in the history
  • Loading branch information
limzykenneth committed Aug 14, 2024
1 parent 757d07d commit 5e040f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ 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 (
((window.setup && typeof window.setup === 'function') ||
(window.draw && typeof window.draw === 'function')) &&
!p5.instance
) {
const p5ReadyEvent = new Event('p5Ready');
window.dispatchEvent(p5ReadyEvent);
new p5();
}
}
Expand Down

0 comments on commit 5e040f9

Please sign in to comment.