-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π Correctly queue follow-up getScript requests
- Loading branch information
Showing
1 changed file
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2317,7 +2317,7 @@ Scene.setMethod(function _setPageTitle(title) { | |
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.0.0 | ||
* @version 2.3.15 | ||
* @version 2.4.0 | ||
* | ||
* @param {Object} options | ||
* @param {Boolean} force Force a reload if already loaded? | ||
|
@@ -2347,11 +2347,29 @@ Scene.setMethod(function getScript(options, force) { | |
let tasks = []; | ||
|
||
for (let entry of path) { | ||
let task_pledge = that.getScript(entry, force); | ||
|
||
if (task_pledge && !task_pledge.is_done) { | ||
// If this is the first script, already start getting it now | ||
if (!tasks.length) { | ||
let task_pledge = that.getScript(entry, force); | ||
|
||
if (!task_pledge || task_pledge.is_done) { | ||
continue; | ||
} | ||
|
||
tasks.push(task_pledge); | ||
continue; | ||
} | ||
|
||
// Other scripts should be queued | ||
tasks.push(next => { | ||
let task_pledge = that.getScript(entry, force); | ||
|
||
if (!task_pledge || task_pledge.is_done) { | ||
return next(); | ||
} | ||
|
||
Classes.Pledge.Swift.done(task_pledge, next); | ||
}); | ||
} | ||
|
||
if (!tasks.length) { | ||
|