Added pskl.utils.Environment for detecting if Piskel is running in Node-Webkit.
This commit is contained in:
parent
294af67099
commit
1c66282b01
2 changed files with 26 additions and 0 deletions
25
src/js/utils/Environment.js
Normal file
25
src/js/utils/Environment.js
Normal 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;
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue