Timer¶
Timer Event¶
Timer¶
- async detroit_live.timer(callback: Callable[[float, TimerEvent], None], delay: float | None = None, starting_time: float | None = None) Timer¶
Schedules a new timer, invoking the specified
callbackrepeatedly until the timer is stopped. An optional numeric delay in milliseconds may be specified to invoke the givencallbackafter adelay; ifdelayis not specified, it defaults to zero. Thedelayis relative to the specifiedstarting_timein milliseconds; ifstarting_timeis not specified, it defaults to now.- Parameters:
callback (Callable[[float, TimerEvent], None]) – Callback
delay (float | None) – Delay value
starting_time (float | None) – Starting time value
- Returns:
Timer
- Return type:
- class detroit_live.timer.timer.Timer¶
- async restart(callback: Callable[[float, TimerEvent], None], delay: float | None = None, starting_time: float | None = None) int¶
- stop()¶
Interval¶
- async detroit_live.interval(callback: Callable[[float, TimerEvent], None], delay: float | None = None, starting_time: float | None = None) Timer | Interval¶
The
callbackis invoked only every delay milliseconds; ifdelayis not specified, this is equivalent to timer.- Parameters:
callback (Callable[[float, TimerEvent], None]) – Callback
delay (float | None) – Delay value
starting_time (float | None) – Starting time value
- Returns:
Timerifdelayis not specified elseInterval.- Return type:
- class detroit_live.timer.interval.Interval¶
- async restart(callback: Callable[[float, TimerEvent], None], delay: float | None = None, starting_time: float | None = None) int¶
- stop()¶
Timeout¶
- async detroit_live.timeout(callback: Callable[[float, TimerEvent], None], delay: float | None = None, starting_time: float | None = None) Timer¶
Automatically stops on its first callback.
- Parameters:
callback (Callable[[float, TimerEvent], None]) – Callback
delay (float | None) – Delay value
starting_time (float | None) – Starting time value
- Returns:
Timer with timeout
- Return type: