clock.js 485 B

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