Class: shaka.util.Timer

Constructor

new Timer(callback)

A simple cancelable timer.
Parameters:
Name Type Description
callback Function
Source:

Members

(private) callback_ :Function

Type:
  • Function
Source:

(private, nullable) id_ :number

Type:
  • number
Source:

(private) timeoutSeconds_ :number

Type:
  • number
Source:

Methods

cancel()

Cancel the timer, if it's running.
Source:

rescheduleIfRunning()

If the timer is running, reschedule it using the previous scheduled timeout.
Source:
Examples
If scheduled for 5 seconds, and rescheduled 3 seconds later,
the timer will fire 8 seconds after the original scheduling.
If scheduled for 5 seconds, and rescheduled 6 seconds later,
the timer will already have fired and will not be rescheduled.

schedule(seconds)

Schedule the timer, canceling any previous scheduling.
Parameters:
Name Type Description
seconds number
Source: