Class: shaka.util.Timer

Constructor

new Timer(onTick)

Create a new timer. A timer is committed to a single callback function. While there is no technical reason to do this, it is far easier to understand and use timers when they are connected to one functional idea.
Parameters:
Name Type Description
onTick function
Source:

Members

activeTimers :Map.<!shaka.util.Timer, string>

Tracks all active timer instances, along with the stack trace that created that timer.
Type:
Source:

onTick_ :function()

Each time our timer "does work", we call that a "tick". The name comes from old analog clocks.
Type:
  • function()
Source:

Methods

stop()

Stop the timer and clear the previous behaviour. The timer is still usable after calling |stop|.
Source:

tickAfter(seconds) → {shaka.util.Timer}

Have the timer call |onTick| after |seconds| has elapsed unless |stop| is called first.
Parameters:
Name Type Description
seconds number
Source:
Returns:
Type
shaka.util.Timer

tickEvery(seconds) → {shaka.util.Timer}

Have the timer call |onTick| every |seconds| until |stop| is called.
Parameters:
Name Type Description
seconds number
Source:
Returns:
Type
shaka.util.Timer

tickNow() → {shaka.util.Timer}

Have the timer call |onTick| now.
Source:
Returns:
Type
shaka.util.Timer