이 비교의 나머지 부분을 불러오는 중입니다.

TW 5.3.0 vs TD 20

생성일 비교 결과 만료 없음
두 텍스트가 동일합니다
두 텍스트 간 차이점이 없습니다
0 삭제
871 행
0 추가
871 행
/*\
/*\
title: $:/boot/boot.js
title: $:/boot/boot.js
type: application/javascript
type: application/javascript


The main boot kernel for TiddlyWiki. This single file creates a barebones TW environment that is just sufficient to bootstrap the modules containing the main logic of the application.
The main boot kernel for TiddlyWiki. This single file creates a barebones TW environment that is just sufficient to bootstrap the modules containing the main logic of the application.


On the server this file is executed directly to boot TiddlyWiki. In the browser, this file is packed into a single HTML file.
On the server this file is executed directly to boot TiddlyWiki. In the browser, this file is packed into a single HTML file.


\*/
\*/


var _boot = (function($tw) {
var _boot = (function($tw) {


/*jslint node: true, browser: true */
/*jslint node: true, browser: true */
/*global modules: false, $tw: false */
/*global modules: false, $tw: false */
"use strict";
"use strict";


// Include bootprefix if we're not given module data
// Include bootprefix if we're not given module data
if(!$tw) {
if(!$tw) {
$tw = require("./bootprefix.js").bootprefix();
$tw = require("./bootprefix.js").bootprefix();
}
}


$tw.utils = $tw.utils || Object.create(null);
$tw.utils = $tw.utils || Object.create(null);


/////////////////////////// Standard node.js libraries
/////////////////////////// Standard node.js libraries


var fs, path, vm;
var fs, path, vm;
if($tw.node) {
if($tw.node) {
fs = require("fs");
fs = require("fs");
path = require("path");
path = require("path");
vm = require("vm");
vm = require("vm");
}
}


/////////////////////////// Utility functions
/////////////////////////// Utility functions


$tw.boot.log = function(str) {
$tw.boot.log = function(str) {
$tw.boot.logMessages = $tw.boot.logMessages || [];
$tw.boot.logMessages = $tw.boot.logMessages || [];
$tw.boot.logMessages.push(str);
$tw.boot.logMessages.push(str);
}
}


/*
/*
Check if an object has a property
Check if an object has a property
*/
*/
$tw.utils.hop = function(object,property) {
$tw.utils.hop = function(object,property) {
return object ? Object.prototype.hasOwnProperty.call(object,property) : false;
return object ? Object.prototype.hasOwnProperty.call(object,property) : false;
};
};


/*
/*
Determine if a value is an array
Determine if a value is an array
*/
*/
$tw.utils.isArray = function(value) {
$tw.utils.isArray = function(value) {
return Object.prototype.toString.call(value) == "[object Array]";
return Object.prototype.toString.call(value) == "[object Array]";
};
};


/*
/*
Check if an array is equal by value and by reference.
Check if an array is equal by value and by reference.
*/
*/
$tw.utils.isArrayEqual = function(array1,array2) {
$tw.utils.isArrayEqual = function(array1,array2) {
if(array1 === array2) {
if(array1 === array2) {
return true;
return true;
}
}
array1 = array1 || [];
array1 = array1 || [];
array2 = array2 || [];
array2 = array2 || [];
if(array1.length !== array2.length) {
if(array1.length !== array2.length) {
return false;
return false;
}
}
return array1.every(function(value,index) {
return array1.every(function(value,index) {
return value === array2[index];
return value === array2[index];
});
});
};
};


/*
/*
Add an entry to a sorted array if it doesn't already exist, while maintaining the sort order
Add an entry to a sorted array if it doesn't already exist, while maintaining the sort order
*/
*/
$tw.utils.insertSortedArray = function(array,value) {
$tw.utils.insertSortedArray = function(array,value) {
var low = 0, high = array.length - 1, mid, cmp;
var low = 0, high = array.length - 1, mid, cmp;
while(low <= high) {
while(low <= high) {
mid = (low + high) >> 1;
mid = (low + high) >> 1;
cmp = value.localeCompare(array[mid]);
cmp = value.localeCompare(array[mid]);
if(cmp > 0) {
if(cmp > 0) {
low = mid + 1;
low = mid + 1;
} else if(cmp < 0) {
} else if(cmp < 0) {
high = mid - 1;
high = mid - 1;
} else {
} else {
return array;
return array;
}
}
}
}
array.splice(low,0,value);
array.splice(low,0,value);
return array;
return array;
};
};


/*
/*
Push entries onto an array, removing them first if they already exist in the array
Push entries onto an array, removing them first if they already exist in the array
array: array to modify (assumed to be free of duplicates)
array: array to modify (assumed to be free of duplicates)
value: a single value to push or an array of values to push
value: a single value to push or an array of values to push
*/
*/
$tw.utils.pushTop = function(array,value) {
$tw.utils.pushTop = function(array,value) {
var t,p;
var t,p;
if($tw.utils.isArray(value)) {
if($tw.utils.isArray(value)) {
// Remove any array entries that are duplicated in the new values
// Remove any array entries that are duplicated in the new values
if(value.length !== 0) {
if(value.length !== 0) {