mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Add a callback to $tw.boot.boot() (#2885)
* Add a callback to $tw.boot.boot() * Move callback into the options object * Update boot.js
This commit is contained in:
parent
18cd37c2de
commit
0bc325025a
13
boot/boot.js
13
boot/boot.js
@ -2017,7 +2017,7 @@ $tw.boot.startup = function(options) {
|
|||||||
$tw.boot.executedStartupModules = Object.create(null);
|
$tw.boot.executedStartupModules = Object.create(null);
|
||||||
$tw.boot.disabledStartupModules = $tw.boot.disabledStartupModules || [];
|
$tw.boot.disabledStartupModules = $tw.boot.disabledStartupModules || [];
|
||||||
// Repeatedly execute the next eligible task
|
// Repeatedly execute the next eligible task
|
||||||
$tw.boot.executeNextStartupTask();
|
$tw.boot.executeNextStartupTask(options.callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2032,14 +2032,14 @@ $tw.addUnloadTask = function(task) {
|
|||||||
/*
|
/*
|
||||||
Execute the remaining eligible startup tasks
|
Execute the remaining eligible startup tasks
|
||||||
*/
|
*/
|
||||||
$tw.boot.executeNextStartupTask = function() {
|
$tw.boot.executeNextStartupTask = function(callback) {
|
||||||
// Find the next eligible task
|
// Find the next eligible task
|
||||||
var taskIndex = 0, task,
|
var taskIndex = 0, task,
|
||||||
asyncTaskCallback = function() {
|
asyncTaskCallback = function() {
|
||||||
if(task.name) {
|
if(task.name) {
|
||||||
$tw.boot.executedStartupModules[task.name] = true;
|
$tw.boot.executedStartupModules[task.name] = true;
|
||||||
}
|
}
|
||||||
return $tw.boot.executeNextStartupTask();
|
return $tw.boot.executeNextStartupTask(callback);
|
||||||
};
|
};
|
||||||
while(taskIndex < $tw.boot.remainingStartupModules.length) {
|
while(taskIndex < $tw.boot.remainingStartupModules.length) {
|
||||||
task = $tw.boot.remainingStartupModules[taskIndex];
|
task = $tw.boot.remainingStartupModules[taskIndex];
|
||||||
@ -2064,7 +2064,7 @@ $tw.boot.executeNextStartupTask = function() {
|
|||||||
if(task.name) {
|
if(task.name) {
|
||||||
$tw.boot.executedStartupModules[task.name] = true;
|
$tw.boot.executedStartupModules[task.name] = true;
|
||||||
}
|
}
|
||||||
return $tw.boot.executeNextStartupTask();
|
return $tw.boot.executeNextStartupTask(callback);
|
||||||
} else {
|
} else {
|
||||||
task.startup(asyncTaskCallback);
|
task.startup(asyncTaskCallback);
|
||||||
return true;
|
return true;
|
||||||
@ -2072,6 +2072,7 @@ $tw.boot.executeNextStartupTask = function() {
|
|||||||
}
|
}
|
||||||
taskIndex++;
|
taskIndex++;
|
||||||
}
|
}
|
||||||
|
if(typeof callback === 'function') callback();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2157,7 +2158,7 @@ $tw.hooks.invokeHook = function(hookName /*, value,... */) {
|
|||||||
|
|
||||||
/////////////////////////// Main boot function to decrypt tiddlers and then startup
|
/////////////////////////// Main boot function to decrypt tiddlers and then startup
|
||||||
|
|
||||||
$tw.boot.boot = function() {
|
$tw.boot.boot = function(callback) {
|
||||||
// Initialise crypto object
|
// Initialise crypto object
|
||||||
$tw.crypto = new $tw.utils.Crypto();
|
$tw.crypto = new $tw.utils.Crypto();
|
||||||
// Initialise password prompter
|
// Initialise password prompter
|
||||||
@ -2167,7 +2168,7 @@ $tw.boot.boot = function() {
|
|||||||
// Preload any encrypted tiddlers
|
// Preload any encrypted tiddlers
|
||||||
$tw.boot.decryptEncryptedTiddlers(function() {
|
$tw.boot.decryptEncryptedTiddlers(function() {
|
||||||
// Startup
|
// Startup
|
||||||
$tw.boot.startup();
|
$tw.boot.startup({callback:callback});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user