File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,19 @@ Phaser.Device = function (game) {
4343 * @default
4444 */
4545 this . cordova = false ;
46-
46+
47+ /**
48+ * @property {boolean } node - Is the game running under Node.js?
49+ * @default
50+ */
51+ this . node = false ;
52+
53+ /**
54+ * @property {boolean } nodeWebkit - Is the game running under Node-Webkit?
55+ * @default
56+ */
57+ this . nodeWebkit = false ;
58+
4759 /**
4860 * @property {boolean } ejecta - Is the game running under Ejecta?
4961 * @default
@@ -631,7 +643,21 @@ Phaser.Device.prototype = {
631643 {
632644 this . cordova = true ;
633645 }
634-
646+
647+ if ( typeof process !== "undefined" && typeof require !== "undefined" )
648+ {
649+ this . node = true ;
650+ }
651+
652+ if ( this . node )
653+ {
654+ try {
655+ this . nodeWebkit = ( typeof require ( 'nw.gui' ) !== "undefined" ) ;
656+ } catch ( error ) {
657+ this . nodeWebkit = false ;
658+ }
659+ }
660+
635661 if ( navigator [ 'isCocoonJS' ] )
636662 {
637663 this . cocoonJS = true ;
You can’t perform that action at this time.
0 commit comments