@@ -37,8 +37,7 @@ class p5 {
37
37
//////////////////////////////////////////////
38
38
// PUBLIC p5 PROPERTIES AND METHODS
39
39
//////////////////////////////////////////////
40
- const hasGlobalSetupOrDraw = typeof window . setup === 'function' || typeof window . draw === 'function' ;
41
- this . _isGlobal = ! sketch || hasGlobalSetupOrDraw ;
40
+ this . _isGlobal = ! sketch ;
42
41
/**
43
42
* A function that's called once to load assets before the sketch runs.
44
43
*
@@ -661,9 +660,6 @@ class p5 {
661
660
// ensure correct reporting of window dimensions
662
661
this . _updateWindowSize ( ) ;
663
662
664
- // Set up promise preloads
665
- this . _setupPromisePreloads ( ) ;
666
-
667
663
const friendlyBindGlobal = this . _createFriendlyGlobalFunctionBinder ( ) ;
668
664
669
665
// If the user has created a global setup or draw function,
@@ -702,10 +698,13 @@ class p5 {
702
698
// detects capitalization mistakes only ( Setup, SETUP, MouseClicked, etc)
703
699
p5 . _checkForUserDefinedFunctions ( this ) ;
704
700
}
701
+ // Bind events to window (not using container div bc key events don't work)
702
+ this . _updateWindowSize ( ) ;
705
703
706
704
// call any registered init functions
707
705
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 ( ) ;
709
708
710
709
for ( const e in this . _events ) {
711
710
const f = this [ `_on${ e } ` ] ;
0 commit comments