mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
Add support for "before" field on startup modules
This commit is contained in:
parent
5b5621a600
commit
09156af475
11
boot/boot.js
11
boot/boot.js
@ -1750,6 +1750,7 @@ $tw.boot.executeNextStartupTask = function() {
|
|||||||
if($tw.boot.isStartupTaskEligible(task)) {
|
if($tw.boot.isStartupTaskEligible(task)) {
|
||||||
// Remove this task from the list
|
// Remove this task from the list
|
||||||
$tw.boot.remainingStartupModules.splice(taskIndex,1);
|
$tw.boot.remainingStartupModules.splice(taskIndex,1);
|
||||||
|
console.log("Executing task",task.name);
|
||||||
// Execute it
|
// Execute it
|
||||||
if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
|
if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
|
||||||
task.startup();
|
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
|
// Check that all of the tasks that we must be performed after has been done
|
||||||
var after = taskModule.after;
|
var after = taskModule.after;
|
||||||
if(after) {
|
if(after) {
|
||||||
|
@ -10,11 +10,12 @@ The startup mechanism runs the installed startup modules at the end of the [[boo
|
|||||||
|
|
||||||
Modules with their ''module-type'' field set to `startup`:
|
Modules with their ''module-type'' field set to `startup`:
|
||||||
|
|
||||||
* Must expose a `startup` function
|
* Must export a `startup` function
|
||||||
** For synchronous startup modules the startup function is called as `startup()`, asynchronous modules are passed a callback they must invoke on completion: `startup(callback)`
|
** For synchronous startup modules the startup function is called as `startup()`, asynchronous modules are passed a callback they must invoke on completion: `startup(callback)`
|
||||||
* May expose a `name` property that is used to identify the task
|
* May export a `name` property that is used to identify the task
|
||||||
* May expose a `after` property containing an array of names of dependent tasks that must be run before this one
|
* May export a `after` property containing an array of names of dependent tasks that must be run before this one
|
||||||
* May expose a `platforms` property containing an array of names of platforms that are required in order for the startup module to be executed. The defined platforms are ''node'' and ''browser''
|
* May export a `before` property containing an array of names of tasks that must be run after this one
|
||||||
|
* May export a `platforms` property containing an array of names of platforms that are required in order for the startup module to be executed. The defined platforms are ''node'' and ''browser''
|
||||||
|
|
||||||
! Startup Processing
|
! Startup Processing
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user