clock.js 485 B

123456789101112131415161718
  1. import Ember from 'ember';
  2. import config from '../config/environment';
  3. export default Ember.Service.extend({
  4. tick: Ember.computed.oneWay('_tick').readOnly(),
  5. doTick: function () {
  6. var self = this;
  7. if (config.environment !== 'test') {
  8. // running this loop in tests will block promises resolution
  9. Ember.run.later(function () {
  10. self.toggleProperty('_tick');
  11. }, config.APP.tickFrequency);
  12. }
  13. }.observes('_tick').on('init'),
  14. _tick: false
  15. });