travis-web/assets/scripts/lib/travis/ticker.coffee

17 lines
402 B
CoffeeScript

@Travis.Ticker = Ember.Object.extend
init: ->
@schedule() unless @get('interval') == -1
tick: ->
context = @get('context')
targets = @get('targets') || [@get('target')]
for target in targets
target = context.get(target) if context
target.tick() if target
@schedule()
schedule: ->
Ember.run.later((=> @tick()), @get('interval') || Travis.app.TICK_INTERVAL)