Added pskl.utils.Environment for detecting if Piskel is running in Node-Webkit.

This commit is contained in:
Lee Grey 2015-03-14 00:11:24 +13:00
parent 294af67099
commit 1c66282b01
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,25 @@
/**
* detection method from:
* http://videlais.com/2014/08/23/lessons-learned-from-detecting-node-webkit/
*/
(function () {
var ns = $.namespace('pskl.utils');
ns.Environment = {
detectNodeWebkit : function () {
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
var isNodeWebkit = false;
if (isNode) {
try {
isNodeWebkit = (typeof require('nw.gui') !== "undefined");
} catch (e) {
isNodeWebkit = false;
}
}
return isNodeWebkit;
}
};
})();

View File

@ -22,6 +22,7 @@
"js/utils/FileUtils.js",
"js/utils/FrameTransform.js",
"js/utils/FrameUtils.js",
"js/utils/Environment.js",
"js/utils/LayerUtils.js",
"js/utils/ImageResizer.js",
"js/utils/PixelUtils.js",