kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Refine node vs. browser behaviour
Now we’re using TiddlyWiki as the core of TiddlyDesktop we need more granular control of the platform specific code.print-window-tiddler
rodzic
b1c5d7694e
commit
d2c4920ba4
|
@ -19,7 +19,7 @@ exports.synchronous = true;
|
||||||
exports.startup = function() {
|
exports.startup = function() {
|
||||||
// Load modules
|
// Load modules
|
||||||
$tw.modules.applyMethods("utils",$tw.utils);
|
$tw.modules.applyMethods("utils",$tw.utils);
|
||||||
if($tw.node && !$tw.browser) {
|
if($tw.node) {
|
||||||
$tw.modules.applyMethods("utils-node",$tw.utils);
|
$tw.modules.applyMethods("utils-node",$tw.utils);
|
||||||
}
|
}
|
||||||
$tw.modules.applyMethods("global",$tw);
|
$tw.modules.applyMethods("global",$tw);
|
||||||
|
|
|
@ -524,10 +524,11 @@ exports.isValidFieldName = function(name) {
|
||||||
Extract the version number from the meta tag or from the boot file
|
Extract the version number from the meta tag or from the boot file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if($tw.browser) {
|
|
||||||
|
|
||||||
// Browser version
|
// Browser version
|
||||||
exports.extractVersionInfo = function() {
|
exports.extractVersionInfo = function() {
|
||||||
|
if($tw.packageInfo) {
|
||||||
|
return $tw.packageInfo.version;
|
||||||
|
} else {
|
||||||
var metatags = document.getElementsByTagName("meta");
|
var metatags = document.getElementsByTagName("meta");
|
||||||
for(var t=0; t<metatags.length; t++) {
|
for(var t=0; t<metatags.length; t++) {
|
||||||
var m = metatags[t];
|
var m = metatags[t];
|
||||||
|
@ -535,18 +536,10 @@ exports.extractVersionInfo = function() {
|
||||||
return m.content;
|
return m.content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// Server version
|
|
||||||
exports.extractVersionInfo = function() {
|
|
||||||
return $tw.packageInfo.version;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the animation duration in ms
|
Get the animation duration in ms
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,8 +13,8 @@ A sync adaptor module for synchronising with the local filesystem via node.js AP
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Get a reference to the file system
|
// Get a reference to the file system
|
||||||
var fs = !$tw.browser ? require("fs") : null,
|
var fs = $tw.node ? require("fs") : null,
|
||||||
path = !$tw.browser ? require("path") : null;
|
path = $tw.node ? require("path") : null;
|
||||||
|
|
||||||
function FileSystemAdaptor(options) {
|
function FileSystemAdaptor(options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
Ładowanie…
Reference in New Issue