new Ticker()
A (low) resolution clock and event queue that has the ability to queue events based on tick count and absolute time. Tickers can also
sync with other "master" clocks through the use of a catch-up/slowdown algorithm.
Members
-
target_tps :number
-
Ticks per second this clock should operate at in the long-term. If this value gets changed, catch-up algorithm precalc values will need to be changed accordingly as well.
- Default Value:
- classes.common.Ticker.TickerConstants#tps
- See:
-
- classes.common.Ticker#fast_forward_to_tick
-
target_tps :number
-
Ticks per second this clock should operate at in the long-term. If this value gets changed, catch-up algorithm precalc values will need to be changed accordingly as well.
- Default Value:
- classes.common.Ticker.TickerConstants#tps
- See:
-
- classes.common.Ticker#fast_forward_to_tick
-
tps :number
-
Ticks per second this clock is currently operating at. This value may be used as an external reference value but the most accurate measure is 1000/
classes.common.Ticker.Ticker#simulation_timestep
- Default Value:
- classes.common.Ticker.TickerConstants#tps
Methods
-
__init__(idopt, opts) → {classes.common.Ticker.Ticker}
-
Default initializer for a Ticker.
Parameters:
Name Type Attributes Default Description id
string <optional>
nanotime._str The ID of this Ticker. opts
Object Options for this Ticker. Properties
Name Type Attributes Default Description tps
number <optional>
classes.common.Ticker.TickerConstants.tps Ticks per second to operate the ticker. simulation_timestep
number <optional>
1000/opts.tps Timestep (ms) per tick. See classes.common.Ticker.Ticker#simulation_timestep
tps_alpha
number <optional>
classes.common.Ticker.TickerConstants.tps_alpha Ticks per second to operate the ticker. Returns:
classes.common.Ticker.Ticker - The initialised Ticker object. -
package, inner DefaultExports(deps) → {classes.common.Ticker.Ticker}
-
Generates a Ticker class. Called internally within the Ticker sub-folder assembly.
Parameters:
Name Type Description deps
Object Dependencies of the Ticker. Properties
Name Type Description IDCreatable
interfaces.IDCreatable Ticker's super interface. TickerConstants
classes.common.Ticker.TickerConstants Default values for a Ticker object. TickerDataManager
classes.common.Ticker.TickerDataManager Provides data gets/sets for tickers. TickerDateTimeUpdateManager
classes.common.Ticker.TickerDateTimeUpdateManager Manages absolute/IRL time-based timers. TickerTickCountUpdateManager
classes.common.Ticker.TickerTickCountUpdateManager Manages tick-count-based timers. Returns:
classes.common.Ticker.Ticker - The Ticker class