mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Merge pull request #1851 from rblopes/detect-nwjs-electro
Changes for nw.js-like environment detection code
This commit is contained in:
commit
88524cd1ce
1 changed files with 10 additions and 8 deletions
|
@ -87,6 +87,12 @@ Phaser.Device = function () {
|
|||
*/
|
||||
this.nodeWebkit = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} electron - Is the game running under GitHub Electron?
|
||||
* @default
|
||||
*/
|
||||
this.electron = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} ejecta - Is the game running under Ejecta?
|
||||
* @default
|
||||
|
@ -913,15 +919,11 @@ Phaser.Device._initialize = function () {
|
|||
device.node = true;
|
||||
}
|
||||
|
||||
if (device.node)
|
||||
if (device.node && typeof window.process.versions === 'object')
|
||||
{
|
||||
try {
|
||||
device.nodeWebkit = (typeof require('nw.gui') !== "undefined");
|
||||
}
|
||||
catch(error)
|
||||
{
|
||||
device.nodeWebkit = false;
|
||||
}
|
||||
device.nodeWebkit = !!window.process.versions['node-webkit'];
|
||||
|
||||
device.electron = !!window.process.versions.electron;
|
||||
}
|
||||
|
||||
if (navigator['isCocoonJS'])
|
||||
|
|
Loading…
Reference in a new issue