1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-09-04 20:08:02 +00:00

Add support for "before" field on startup modules

This commit is contained in:
Jermolene
2014-05-03 19:49:50 +01:00
parent 5b5621a600
commit 09156af475
2 changed files with 16 additions and 4 deletions

View File

@@ -1750,6 +1750,7 @@ $tw.boot.executeNextStartupTask = function() {
if($tw.boot.isStartupTaskEligible(task)) {
// Remove this task from the list
$tw.boot.remainingStartupModules.splice(taskIndex,1);
console.log("Executing task",task.name);
// Execute it
if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
task.startup();
@@ -1783,6 +1784,16 @@ $tw.boot.isStartupTaskEligible = function(taskModule) {
}
}
}
// Check that no other outstanding tasks must be executed before this one
var name = taskModule.name,
remaining = $tw.boot.remainingStartupModules;
if(name) {
for(t=0; t<remaining.length; t++) {
if(remaining[t].before && remaining[t].before.indexOf(name) !== -1) {
return false;
}
}
}
// Check that all of the tasks that we must be performed after has been done
var after = taskModule.after;
if(after) {