The actual function to call. This should return one of the known CallbackReturnType values.
Static
Readonly
KEEPPossible return value for the handler.
Do not do anything. Same as not retuning anything from the function.
Static
Readonly
REMOVEPossible return value for the handler.
Will remove this callback.
Static
Readonly
wrapWraps the given handler or callback as a callback, optionally debounced by the given debounce window.
If the argument is already a callback or an invoke method of a callback,
then the wrapper will call that callback and return the same value as it.
It will also set up the returned wrapper callback so that it is removed
when the original (given) callback is removed. However, removing the
returned wrapper callback will not cause the original callback (being
wrapped) to be removed. If you want to do this, then do
wrapper.onRemove(wrapped.remove)
.
Note that if the argument is a callback that's already debounced by a
larger window, then debounceWindow
will have no effect.
Readonly
invokeCall the handler with the given arguments.
If the handler is asynchronous, it awaits on it. Furthermore, calls will always wait for previous calls to this handler to complete first, i.e. it never runs concurrently to itself. If you need multiple calls to the async handler to run concurrently, then wrap it in a non-async function that does not await it.
The returned promise is rejected in two cases:
LisnUsageError If the callback is already removed.
Readonly
isReturns true if the callback has been removed and cannot be called again.
Readonly
onRegisters the given function to be called when the callback is removed.
You can call onRemove multiple times to register multiple hooks.
Readonly
removeMark the callback as removed and call the registered onRemove hooks.
Future attempts to call it will result in LisnUsageError.
Callback wraps user-supplied callbacks. Supports