Skip to content

Commit

Permalink
Refactored window size function calling location
Browse files Browse the repository at this point in the history
  • Loading branch information
bensgilbert authored Jul 19, 2024
1 parent e0f316d commit d8b0fa5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ class p5 {
this._events.devicemotion = null;
}

this.registerMethod('init', this._updateWindowSize);

// Function to invoke registered hooks before or after events such as preload, setup, and pre/post draw.
p5.prototype.callRegisteredHooksFor = function (hookName) {
const target = this || p5.prototype;
Expand Down Expand Up @@ -660,6 +658,9 @@ class p5 {
}
};

// ensure correct reporting of window dimensions
this._updateWindowSize();

// call any registered init functions
this._registeredMethods.init.forEach(function(f) {
if (typeof f !== 'undefined') {
Expand Down

0 comments on commit d8b0fa5

Please sign in to comment.