Skip to content

Commit d547252

Browse files
Dan CoxDan Cox
authored andcommitted
Device detection of Apache Cordova
Simple check if "window.cordova" is defined for device detection of Phaser running (most likely) under Apache Cordova.
1 parent 6da5831 commit d547252

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/system/Device.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Phaser.Device = function (game) {
3737
* @default
3838
*/
3939
this.cocoonJS = false;
40+
41+
/**
42+
* @property {boolean} cordova - Is the game running under Apache Cordova?
43+
* @default
44+
*/
45+
this.cordova = false;
4046

4147
/**
4248
* @property {boolean} ejecta - Is the game running under Ejecta?
@@ -620,6 +626,11 @@ Phaser.Device.prototype = {
620626
{
621627
this.webApp = true;
622628
}
629+
630+
if (typeof window.cordova !== "undefined")
631+
{
632+
this.cordova = true;
633+
}
623634

624635
if (navigator['isCocoonJS'])
625636
{

0 commit comments

Comments
 (0)