PhoneGap/Cordova signal issue finally fixed

We've been moving internally more towards using Cordova as the app wrapper for webOS applications, so we recently hit some of the problems long reported on the forum about the signals in our cordova.js file not being hooked up correctly.

The good news is that we've got a fix. If you look at https://github.com/enyojs/enyo/commit/48047d268d947f9c0e4f1a194ee0561c61e7bba7, you'll see that we found that Cordova is wrapping addEventListener on the document object, adding their own table of events. They do go ahead and directly fire the deviceready event, but all other Cordova events only work if you've registered after deviceready fires.

This fix can't be directly applied to 2.2 because it uses the new enyo.ready() method, but it's really only doing that to be able to detect the Cordova JS object and not run all this code in the non-Cordova/PhoneGap environment.

Comments

  • I've noticed this hasn't worked right in 2.2.
    But a workaround is to just create a deviceReady function and then manually add which events to add
    enyo.dispatcher.listen(document, "backbutton");
    enyo.dispatcher.listen(document, "menubutton");
    Thats how i've been doing it in my apps.


    Glad to hear it is fixed in the core now.
Sign In or Register to comment.