docs » hs.timer.delayed
Specialized timer objects to coalesce processing of unpredictable asynchronous events into a single callback
- Constructors - API calls which return an object, typically one that offers API methods
- new
- Methods - API calls which can only be made on an object returned by a constructor
- nextTrigger
- running
- setDelay
- start
- stop
| Signature | hs.timer.delayed.new(delay, fn) -> hs.timer.delayed object |
|---|---|
| Type | Constructor |
| Description | Creates a new delayed timer. |
| 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 |
|