new SerialTimer()
A SerialTimer is a synchronous timer device. You can use it to run your emulator synchronously (ie. blocking the main thread). It also has the ability to only run a finite number of ticks before returning, which is quite valuable when debugging engines.
- Implements:
- Source:
Methods
-
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
-
one()
-
Start the emulator. Run a single cycle then exit.
- 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: