Class: shaka.util.Timer

Constructor

(export) 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

(private) onTick_ :function()

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

Methods

(export) stop()

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

(export) tickAfter(seconds) → (non-null) {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

(export) tickEvery(seconds) → (non-null) {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

(export) tickNow() → (non-null) {shaka.util.Timer}

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