ember.js - Heyoffline in Ember CLI -
i building ember cli app , want use heyoffline.js. have installed using bower:
bower.js:
"heyoffline": "~1.1.1"
brocfile:
app.import('bower_components/heyoffline/heyoffline.js');
i trying load using initialiser, below. not seem work - nothing happens when go offline. there no errors in console. loading incorrectly? thanks.
export default { name: 'heyoffline', initialize: function() { document.addeventlistener('deviceready', function () { new heyoffline(); }, false); } };
i managed working setting "service" instance of heyoffline in application, follows:
export default { name: 'heyoffline', initialize: function(registry, application) { ... var heyoffline = heyoffline.create(); application.set('service', heyoffline); } };
i had create ember object heyoffline:
var heyoffline = ember.object.extend({ service: null, init: function() { this.set('service', new heyoffline()); this.set('service.options.disabledismiss', true); //this optional, see http://krawczyk.io/heyoffline.js/ } });
comments welcome :)
Comments
Post a Comment