new AsyncTimer(options)
An AsyncTimer is an asynchronous timer device. You can use it to run your emulator without blocking your main thread. However, unless you really want to implement a new asynchronous device on top of a new API, you're probably looking for AnimationFrameTimer for browser environments, or ImmediateTimer for Node.js environments.
Parameters:
Name | Type | Argument | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The timer options. Properties
|
- Implements:
- Source:
- See:
Methods
-
<protected> cancel()
-
This method should be specialized, either via subclassing, or by passing the proper parameter when instanciating the timer.
- Source:
-
cancelTick(handler)
-
An engine will call this function if it wants to prevent a scheduled function from being executed.
Parameters:
Name Type Description handler
Opaque The handler returned by Timer#nextTick.
- Implements:
- Source:
-
nextTick(fn)
-
An engine will call this function if it wants to schedule a function to be called at the next tick.
Parameters:
Name Type Description fn
function The function that should be registered.
- Implements:
- Source:
Returns:
handler
- Type
- Opaque
-
<protected> prepare()
-
This method should be specialized, either via subclassing, or by passing the proper parameter when instanciating the timer.
- Source:
-
start(beginning, ending)
-
Start the timer.
Parameters:
Name Type Argument Description beginning
function <optional>
An optional function that will be called before each tick.
ending
function <optional>
An optional function that will be caled after each tick.
- Implements:
- Source:
-
stop()
-
Stop the timer.
- Implements:
- Source: