Skip to content

Commit

Permalink
Merge pull request #7173 from limzykenneth/fes-init
Browse files Browse the repository at this point in the history
Tie FES initialization to only run just before p5 init
  • Loading branch information
Qianqianye authored Aug 14, 2024
2 parents b467200 + 5e040f9 commit f9fcff8
Show file tree
Hide file tree
Showing 2 changed files with 4 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;
3 changes: 3 additions & 0 deletions src/core/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const _globalInit = () => {
}

if (!window.mocha) {
const p5ReadyEvent = new Event('p5Ready');
window.dispatchEvent(p5ReadyEvent);

// If there is a setup or draw function on the window
// then instantiate p5 in "global" mode
if (
Expand Down

0 comments on commit f9fcff8

Please sign in to comment.