mardi 1 septembre 2015

Ember Initializer - using handleOpenURL Phonegap

I'm using Ember 1.13 (& ember-cli) with Phonegap cli-5.1.1 and the custom url plugin.

The plugin calls window.handleOpenURL() whenever the app is accessed from a custom url eg. app://xyz. It then needs to transition to a route based on xyz.

With the latest versions of Ember initializers where should this code go though?

If the window.handleOpenURL() function is defined in an initializer then there doesn't seem a way to make a transition. But if it's defined in an instance initializer, then the function doesn't fire from a coldstart (presumably because the code isn't ready yet).

Perhaps it could go in an initializer but then save xyz to a global variable which is then looked up on the application route beforeModel hook. Except this wouldn't get called if the application was resuming rather than loading.

Help appreciated.




Aucun commentaire:

Enregistrer un commentaire