1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 00:50:28 +00:00

Allow callers of the bootprefix to determine browser status

This gives us finer control under node-webkit of whether the core
thinks we’re running under the browser or node.
This commit is contained in:
Jermolene 2015-01-11 14:21:31 +00:00
parent 0fdfbc482c
commit 3bbbda0819

View File

@ -20,9 +20,15 @@ $tw = $tw || Object.create(null);
$tw.boot = $tw.boot || Object.create(null);
// Detect platforms
$tw.browser = typeof(window) !== "undefined" ? {} : null;
$tw.node = typeof(process) === "object" ? {} : null;
$tw.nodeWebKit = $tw.node && global.window && global.window.nwDispatcher ? {} : null;
if(!("browser" in $tw)) {
$tw.browser = typeof(window) !== "undefined" ? {} : null;
}
if(!("node" in $tw)) {
$tw.node = typeof(process) === "object" ? {} : null;
}
if(!("nodeWebKit" in $tw)) {
$tw.nodeWebKit = $tw.node && global.window && global.window.nwDispatcher ? {} : null;
}
// Set default boot tasks
$tw.boot.tasks = {