File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,12 @@ Phaser.Device = function () {
8787 */
8888 this . nodeWebkit = false ;
8989
90+ /**
91+ * @property {boolean } electron - Is the game running under GitHub Electron?
92+ * @default
93+ */
94+ this . electron = false ;
95+
9096 /**
9197 * @property {boolean } ejecta - Is the game running under Ejecta?
9298 * @default
@@ -913,15 +919,11 @@ Phaser.Device._initialize = function () {
913919 device . node = true ;
914920 }
915921
916- if ( device . node )
922+ if ( device . node && typeof window . process . versions === 'object' )
917923 {
918- try {
919- device . nodeWebkit = ( typeof require ( 'nw.gui' ) !== "undefined" ) ;
920- }
921- catch ( error )
922- {
923- device . nodeWebkit = false ;
924- }
924+ device . nodeWebkit = ! ! window . process . versions [ 'node-webkit' ] ;
925+
926+ device . electron = ! ! window . process . versions . electron ;
925927 }
926928
927929 if ( navigator [ 'isCocoonJS' ] )
You can’t perform that action at this time.
0 commit comments