mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
cf36851265
replaces #41, #60 - update ember-suave and grunt-jscs to 3.0 - standardize Ember global de-structuring rules across app & tests
39 lines
607 B
JavaScript
39 lines
607 B
JavaScript
import Ember from 'ember';
|
|
|
|
const {
|
|
Service,
|
|
testing,
|
|
run
|
|
} = Ember;
|
|
|
|
const ONE_SECOND = 1000;
|
|
|
|
// Creates a clock service to run intervals.
|
|
|
|
export default Service.extend({
|
|
second: null,
|
|
minute: null,
|
|
hour: null,
|
|
|
|
init() {
|
|
this.tick();
|
|
},
|
|
|
|
tick() {
|
|
let now = moment().utc();
|
|
this.setProperties({
|
|
second: now.seconds(),
|
|
minute: now.minutes(),
|
|
hour: now.hours()
|
|
});
|
|
|
|
if (!testing) {
|
|
run.later(() => {
|
|
this.tick();
|
|
}, ONE_SECOND);
|
|
}
|
|
|
|
}
|
|
|
|
});
|