mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
26 lines
588 B
JavaScript
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;
|
|
}
|
|
};
|
|
|
|
})();
|