Skip to content

Commit 1da29ca

Browse files
committed
Fix _isgloabl flag in init method
1 parent 455168c commit 1da29ca

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/core/main.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ class p5 {
3737
//////////////////////////////////////////////
3838
// PUBLIC p5 PROPERTIES AND METHODS
3939
//////////////////////////////////////////////
40-
const hasGlobalSetupOrDraw = typeof window.setup === 'function' || typeof window.draw === 'function';
41-
this._isGlobal = !sketch || hasGlobalSetupOrDraw;
40+
this._isGlobal = !sketch;
4241
/**
4342
* A function that's called once to load assets before the sketch runs.
4443
*
@@ -661,9 +660,6 @@ class p5 {
661660
// ensure correct reporting of window dimensions
662661
this._updateWindowSize();
663662

664-
// Set up promise preloads
665-
this._setupPromisePreloads();
666-
667663
const friendlyBindGlobal = this._createFriendlyGlobalFunctionBinder();
668664

669665
// If the user has created a global setup or draw function,
@@ -702,10 +698,13 @@ class p5 {
702698
// detects capitalization mistakes only ( Setup, SETUP, MouseClicked, etc)
703699
p5._checkForUserDefinedFunctions(this);
704700
}
701+
// Bind events to window (not using container div bc key events don't work)
702+
this._updateWindowSize();
705703

706704
// call any registered init functions
707705
this.callRegisteredHooksFor('init');
708-
// Bind events to window (not using container div bc key events don't work)
706+
// Set up promise preloads
707+
this._setupPromisePreloads();
709708

710709
for (const e in this._events) {
711710
const f = this[`_on${e}`];

0 commit comments

Comments
 (0)