Skip to content

Instantly share code, notes, and snippets.

@Turbo87
Last active September 23, 2016 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Turbo87/1b7c9053d07a483a0b70ef25f4afb1bd to your computer and use it in GitHub Desktop.
Save Turbo87/1b7c9053d07a483a0b70ef25f4afb1bd to your computer and use it in GitHub Desktop.
glimmer-issue
import Ember from 'ember';
export default Ember.Controller.extend({
myService: Ember.inject.service(),
init() {
this._super(...arguments);
this.set('controllerArray', ['xxx']);
},
serviceArrayCP: Ember.computed('myService.serviceArray.[]', function() {
return this.get('myService.serviceArray');
}),
});
import Ember from 'ember';
export default Ember.Helper.extend({
compute(value, hash) {
this.clearTimer();
this.timer = Ember.run.later(this, this.recompute, 1000);
return new Date();
},
clearTimer() {
Ember.run.cancel(this.timer);
},
destroy(...args) {
this._super(...args);
this.clearTimer();
}
});
import Ember from 'ember';
export default Ember.Route.extend({
setupController(controller) {
this._super(...arguments);
controller.get('myService')._runOnce();
}
});
import Ember from 'ember';
export default Ember.Service.extend({
init() {
this._super(...arguments);
this.set('serviceArray', Ember.A());
},
_runOnce() {
// this._pushObj();
Ember.run.once(this, this._pushObj);
},
_pushObj() {
console.log('_pushObj');
this.get('serviceArray').pushObject('foo');
},
});
{{time-helper}}
<div class="abc">
{{#each controllerArray as |aaa|}}
{{aaa}}
{{/each}}
</div>
{{log serviceArrayCP}}
{
"version": "0.10.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.9.0-beta.3",
"ember-data": "2.8.0",
"ember-template-compiler": "2.9.0-beta.3",
"ember-testing": "2.9.0-beta.3"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment