Specialized timer objects to coalesce processing of unpredictable asynchronous events into a single callback
Signature | hs.timer.delayed.new(delay, fn) -> hs.timer.delayed object |
---|---|
Type | Constructor |
Description | Creates a new delayed timer. Delayed timers have specialized methods that behave differently from regular timers.
When the You can use a delayed timer to coalesce processing of unpredictable asynchronous events into a single
callback; for example, if you have an event stream that happens in "bursts" of dozens of events at once,
set an appropriate Parameters:
Returns:
Notes:
|
Signature | hs.timer.delayed:nextTrigger() -> number or nil |
---|---|
Type | Method |
Description | Returns the time left in the callback countdown Parameters:
Returns:
|
Signature | hs.timer.delayed:running() -> boolean |
---|---|
Type | Method |
Description | Returns a boolean indicating whether the callback countdown is running Parameters:
Returns:
|
Signature | hs.timer.delayed:setDelay(delay) -> hs.timer.delayed object |
---|---|
Type | Method |
Description | Changes the callback countdown duration Parameters:
Returns:
Notes:
|
Signature | hs.timer.delayed:start([delay]) -> hs.timer.delayed object |
---|---|
Type | Method |
Description | Starts or restarts the callback countdown Parameters:
Returns:
|
Signature | hs.timer.delayed:stop() -> hs.timer.delayed object |
---|---|
Type | Method |
Description | Cancels the callback countdown, if running; the callback will therefore not be triggered Parameters:
Returns:
|