1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-26 19:47:20 +00:00

Refactoring for hygeine

This commit is contained in:
Jermolene 2014-06-19 12:05:41 +01:00
parent c2b08b43b5
commit 19061650de

View File

@ -187,7 +187,7 @@ $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) { $tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
if(source) { if(source) {
for (var p in source) { for (var p in source) {
if(object[p] == null) { if(object[p] === null || object[p] === undefined) {
object[p] = source[p]; object[p] = source[p];
} }
if(typeof object[p] === "object" && typeof source[p] === "object") { if(typeof object[p] === "object" && typeof source[p] === "object") {
@ -1784,9 +1784,15 @@ Execute the remaining eligible startup tasks
*/ */
$tw.boot.executeNextStartupTask = function() { $tw.boot.executeNextStartupTask = function() {
// Find the next eligible task // Find the next eligible task
var taskIndex = 0; var taskIndex = 0, task,
asyncTaskCallback = function() {
if(task.name) {
$tw.boot.executedStartupModules[task.name] = true;
}
return $tw.boot.executeNextStartupTask();
};
while(taskIndex < $tw.boot.remainingStartupModules.length) { while(taskIndex < $tw.boot.remainingStartupModules.length) {
var task = $tw.boot.remainingStartupModules[taskIndex]; task = $tw.boot.remainingStartupModules[taskIndex];
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);
@ -1810,12 +1816,7 @@ $tw.boot.executeNextStartupTask = function() {
} }
return $tw.boot.executeNextStartupTask(); return $tw.boot.executeNextStartupTask();
} else { } else {
task.startup(function() { task.startup(asyncTaskCallback);
if(task.name) {
$tw.boot.executedStartupModules[task.name] = true;
}
return $tw.boot.executeNextStartupTask();
});
return true; return true;
} }
} }