mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Added pskl.utils.Environment for detecting if Piskel is running in Node-Webkit.
This commit is contained in:
parent
294af67099
commit
1c66282b01
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 New Issue
Block a user