Class: Timer

Timer

new Timer()

Source:

Members

endTime :number

Time (ms) when the timer ended. null if not ended.
Type:
  • number
Source:

finished :boolean

True if the timer has finished.
Type:
  • boolean
Source:

started :boolean

True if the timer has started.
Type:
  • boolean
Source:

startTime :number

Time (ms) when the timer started. null if not started.
Type:
  • number
Source:

totalTime :number

Time (ms) elapsed from start to end. null if the timer has not finished.
Type:
  • number
Source:

Methods

timeEvent(endEvent, endTarget)

Start timing an event immediately, and listen to the given event and target to end the timer.
Parameters:
Name Type Description
endEvent string The event the timer listens to for stopping the timer
endTarget Backbone.Events The object to listen to for stopping the timer
Source:

timeEvents(startEvent, startTarget, endEvent, endTarget)

Start timing when a target event is triggered. Listen to the given event and target to end the timer.
Parameters:
Name Type Argument Description
startEvent string The event the timer listens to for starting the timer
startTarget Backbone.Events The object to listen to for starting the timer.
endEvent string The event the timer listens to for stopping the timer
endTarget Backbone.Events <optional>
The object to listen to for stopping the timer. If not provided, then the endTarget will be the same as the startTarget.
Source: