mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-05 09:50:34 +03:00
a85f5fae35
no issue - fix lint errors in lib/gh-koenig - fix ghost:base eslint errors - update ember plugin refs, remove ember-suave plugin refs - remove old jshint refs - add `lint:js` script - switch to `eslint-plugin-ghost` extending `plugin:ghost/ember`
36 lines
681 B
JavaScript
36 lines
681 B
JavaScript
import Ember from 'ember';
|
|
import Service from '@ember/service';
|
|
import moment from 'moment';
|
|
import {run} from '@ember/runloop';
|
|
|
|
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 (!Ember.testing) { // eslint-disable-line
|
|
run.later(() => {
|
|
this.tick();
|
|
}, ONE_SECOND);
|
|
}
|
|
}
|
|
|
|
});
|