Ember 2.0, Cordova and onDeviceReady
The code in app.js looks like this:
var App;
Ember.MODEL_FACTORY_INJECTIONS = true;
App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver: Resolver
});
export default App;
How do I use deferReadiness and advanceReadiness here? I need this to call advanceReadiness if the cordova deviceReady event is fired.
+3
source to share
1 answer
You can get the app from the initializer:
Just use ember generate initializer cordova
to create a new initializer.
This will create a file named app / initializers / cordova.js . And then you can change it to listen for the event deviceready
like this:
export function initialize(container, application) {
application.deferReadiness();
document.addEventListener("deviceready", function() {
application.advanceReadiness();
}, false);
}
export default {
name: 'cordova',
initialize: initialize
};
+2
source to share