Skip to content

Commit 5e040f9

Browse files
committed
Move init event to run even in instance mode
1 parent 757d07d commit 5e040f9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/init.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ const _globalInit = () => {
2525
}
2626

2727
if (!window.mocha) {
28+
const p5ReadyEvent = new Event('p5Ready');
29+
window.dispatchEvent(p5ReadyEvent);
30+
2831
// If there is a setup or draw function on the window
2932
// then instantiate p5 in "global" mode
3033
if (
3134
((window.setup && typeof window.setup === 'function') ||
3235
(window.draw && typeof window.draw === 'function')) &&
3336
!p5.instance
3437
) {
35-
const p5ReadyEvent = new Event('p5Ready');
36-
window.dispatchEvent(p5ReadyEvent);
3738
new p5();
3839
}
3940
}

0 commit comments

Comments
 (0)