piskel/src/js/utils/Environment.js
2015-04-14 18:02:33 +02:00

26 lines
588 B
JavaScript

/**
* 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 window.process !== 'undefined' && typeof window.require !== 'undefined');
var isNodeWebkit = false;
if (isNode) {
try {
isNodeWebkit = (typeof window.require('nw.gui') !== 'undefined');
} catch (e) {
isNodeWebkit = false;
}
}
return isNodeWebkit;
}
};
})();