Skip to content

Commit

Permalink
Tie FES initialization to only run just before p5 init
Browse files Browse the repository at this point in the history
  • Loading branch information
limzykenneth committed Aug 14, 2024
1 parent b467200 commit 757d07d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/friendly_errors/sketch_reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,6 @@ if (typeof IS_MINIFIED !== 'undefined') {

p5._fesCodeReader = fesCodeReader;

window.addEventListener('load', p5._fesCodeReader);
window.addEventListener('p5Ready', p5._fesCodeReader);
}
export default p5;
2 changes: 2 additions & 0 deletions src/core/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const _globalInit = () => {
(window.draw && typeof window.draw === 'function')) &&
!p5.instance
) {
const p5ReadyEvent = new Event('p5Ready');
window.dispatchEvent(p5ReadyEvent);
new p5();
}
}
Expand Down

0 comments on commit 757d07d

Please sign in to comment.