clock.js 510 B

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