Skip to content

Commit 848e619

Browse files
committed
Await all lifecycle hook functions in parallel
1 parent f7150c2 commit 848e619

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/core/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,9 @@ class p5 {
395395
}
396396

397397
async _runLifecycleHook(hookName) {
398-
for(const hook of p5.lifecycleHooks[hookName]){
399-
await hook.call(this);
400-
}
398+
await Promise.all(p5.lifecycleHooks[hookName].map(hook => {
399+
return hook.call(this);
400+
}));
401401
}
402402

403403
_initializeInstanceVariables() {

0 commit comments

Comments
 (0)