Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova 'deviceready' event check #1120

Merged
merged 1 commit into from Aug 21, 2014

Conversation

Projects
None yet
2 participants
@videlais
Copy link
Contributor

commented Aug 21, 2014

A slightly obnoxious but necessary hack to prevent a race condition between the loading of Apache Cordova and Phaser itself.

Without waiting for the 'deviceready' event, Phaser can often load first, preventing any console messages from appearing to the user. Because Cordova writes to the platform's console (via CordovaLog), it must first be loaded and signal its own 'deviceready' event before console or plugin usage can occur. Otherwise, all messages and functionality is ignored.

Cordova 'deviceready' event check
A slightly obnoxious but necessary hack to prevent a race condition between the loading of Apache Cordova and Phaser itself. 

Without waiting for the 'deviceready' event, Phaser can often load first, preventing any console messages from appearing to the user. Because Cordova writes to the platform's console (via CordovaLog), it must first be loaded and signal its own 'deviceready' event before console or plugin usage can occur. Otherwise, all messages and functionality is ignored.

alvinsight added a commit that referenced this pull request Aug 21, 2014

Merge pull request #1120 from videlais/patch-2
Cordova 'deviceready' event check

@alvinsight alvinsight merged commit 118ea6f into photonstorm:dev Aug 21, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@alvinsight

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2014

It seems like a fair change to me, even though Cordova is not the best way to use Phaser to make mobile apps ;)
Thank you for this !

@videlais

This comment has been minimized.

Copy link
Contributor Author

commented Aug 21, 2014

So, I'm curious. What would you consider the best way to make mobile apps with Phaser?

I've worked with CocoonJS a great deal. With its disappearing images, broken text displaying, limited DOM and total lack of XML support, it's far from perfect at the moment for Phaser. In fact, I know of the "horrible hack" of drawing a rect to the canvas just to get images to work at all.

I've been investigating Cordova some lately, but would be extremely happy to jump to something else if it's better.

@videlais videlais deleted the videlais:patch-2 branch Aug 21, 2014

@alvinsight

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2014

We're aware that Phaser and cocoonJs compatibility is rather mysterious, because some features just work out-of-the-box, and some others just don't, or need additionnal hacks.
But however, cocoonJs only knows WebGL and Canvas, and it knows them so much that it's really fast.
But if your game/app is lightweight cordova should definitely be suitable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.