Merge pull request #1150 from videlais/patch-3

Detect CocoonJS.App
This commit is contained in:
Richard Davey 2014-08-31 00:02:28 +01:00
commit 5cfb51b656

View file

@ -38,6 +38,12 @@ Phaser.Device = function (game) {
*/ */
this.cocoonJS = false; this.cocoonJS = false;
/**
* @property {boolean} cocoonJSApp - Is this game running with CocoonJS.App?
* @default
*/
this.cocoonJSApp = false;
/** /**
* @property {boolean} cordova - Is the game running under Apache Cordova? * @property {boolean} cordova - Is the game running under Apache Cordova?
* @default * @default
@ -662,6 +668,15 @@ Phaser.Device.prototype = {
{ {
this.cocoonJS = true; this.cocoonJS = true;
} }
if(this.cocoonJS)
{
try {
this.cocoonJSApp = (typeof CocoonJS !== "undefined");
} catch(error) {
this.cocoonJSApp = false;
}
}
if (typeof window.ejecta !== "undefined") if (typeof window.ejecta !== "undefined")
{ {