Skip to content

Commit 717784f

Browse files
committed
Fix duplicate p5.js import check and preserve window.p5 constructor
1 parent b052d65 commit 717784f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ class p5 {
125125
// If the user has created a global setup or draw function,
126126
// assume "global" mode and make everything global (i.e. on the window)
127127
if (!sketch) {
128-
if (window.p5 instanceof p5) {
128+
if (typeof window.p5 !== 'undefined') {
129129
console.warn('p5.js appears to have been imported multiple times. This could cause errors.');
130130
return;
131131
}
132132
this._isGlobal = true;
133-
window.p5 = this;
133+
window._p5Instance = this;
134134
if (window.hitCriticalError) {
135135
return;
136136
}

0 commit comments

Comments
 (0)