Hi everyone,
I’m currently working on migrating some of my Phaser games from Electron/Cordova to Harmony OS. To facilitate this transition, I’d like to propose adding a new enum value for Harmony OS in the device.os object.
Currently, the available platform checks include:
scene.sys.game.device.os.android // Is running on android?
scene.sys.game.device.os.chromeOS // Is running on chromeOS?
scene.sys.game.device.os.cordova // Is the game running under Apache Cordova?
scene.sys.game.device.os.crosswalk // Is the game running under the Intel Crosswalk XDK?
scene.sys.game.device.os.desktop // Is running on a desktop?
scene.sys.game.device.os.ejecta // Is the game running under Ejecta?
scene.sys.game.device.os.electron // Is the game running under GitHub Electron?
scene.sys.game.device.os.iOS // Is running on iOS?
scene.sys.game.device.os.iPad // Is running on iPad?
scene.sys.game.device.os.iPhone // Is running on iPhone?
scene.sys.game.device.os.kindle // Is running on an Amazon Kindle?
scene.sys.game.device.os.linux // Is running on linux?
scene.sys.game.device.os.macOS // Is running on macOS?
scene.sys.game.device.os.node // Is the game running under Node.js?
scene.sys.game.device.os.nodeWebkit // Is the game running under Node-/Webkit?
scene.sys.game.device.os.webApp // Set to true if running as a WebApp, i.e. within a WebView
scene.sys.game.device.os.windows // Is running on windows?
scene.sys.game.device.os.windowsPhone // Is running on a Windows Phone?
I propose adding a new entry:
harmony
This would allow for consistent platform detection like:
if (this.sys.game.device.os.harmony) {
// Harmony OS specific code
}
My current code uses platform checks like this:
create() {
this.isMobile = this.sys.game.device.os.android || this.sys.game.device.os.iOS;
if (this.isMobile) {
this._bindGesture();
// globalPlayerObj.debugText = "isMobile=True";
} else {
this._bindMouse();
// globalPlayerObj.debugText = "isMobile=False";
}
}
Adding harmony to the enum would make it easier to handle Harmony OS-specific code in a consistent way, similar to how other platforms are handled.
I’d appreciate any thoughts on this proposal. Thank you!