Skip to content

Instantly share code, notes, and snippets.

@gregtap
Created November 26, 2015 07:22
Show Gist options
  • Select an option

  • Save gregtap/518bac859cb3b424aae5 to your computer and use it in GitHub Desktop.

Select an option

Save gregtap/518bac859cb3b424aae5 to your computer and use it in GitHub Desktop.
✘ Error: Assertion Failed: calling set on destroyed object
import Ember from 'ember';
const { Service, run } = Ember;
/**
* Ticking clock service.
* We use this service to sync all our momentjs udpates every second
* and not start one timer for each message.
*/
export default Service.extend({
init: function() {
this.seconds = 0;
//run.later(this, this.giveMeATick, 1000);
},
giveMeATick: function() {
this.set('tick', this.seconds);
this.seconds += 1;
//run.later(this, this.giveMeATick, 1000);
},
willDestroy: function() {
run.cancel(this.giveMeATick);
},
});
// Even though willDestroy is called I get the
// ✘ Error: Assertion Failed: calling set on destroyed object
// in my test.
// If both run.later calls are commented out then no errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment