Skip to content

Commit

Permalink
use registerDestructor instead of willDestroy
Browse files Browse the repository at this point in the history
  • Loading branch information
lozjackson committed May 11, 2024
1 parent cc2694d commit 07bd8dc
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions addon/services/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import Service from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { cancel, later } from '@ember/runloop';
import { registerDestructor } from '@ember/destroyable';

/**
* ## ClockService
Expand Down Expand Up @@ -58,6 +59,7 @@ export default class ClockService extends Service {
constructor() {
super(...arguments);
this.start();
registerDestructor(this, () => this.stop());
}

/**
Expand Down Expand Up @@ -103,13 +105,4 @@ export default class ClockService extends Service {
}
this.nextTick = later(this, this.tick, 1000);
}

/**
call `stop()`
@event willDestroy
@private
*/
willDestroy() {
this.stop();
}
}

0 comments on commit 07bd8dc

Please sign in to comment.