#
cp.deferred
This extension makes it simple to defer multiple actions after a delay from the initial execution.
Unlike hs.timer.delayed, the delay will not be extended
with subsequent run() calls, but the delay will trigger again if run() is called again later.
For example:
local update = deferred.new(1) -- defer 1 second
:action(function() print("Updated!"") end)
-- do something
update()
-- do something else
update()
-- one second after the inital call to `update()`, one "Updated!" is printed.
#
API Overview
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
action delay run secondsRemaining stop waiting