The type of the function being debounced.
Cancel any pending debounced invocation. The promise returned by the most recent call rejects with an error whose message is DEBOUNCE_CANCELED_ERROR_MESSAGE.
IMPORTANT: because cancellation rejects that promise, every call whose result you might later
cancel MUST handle its rejection (await in a try/catch, or attach a .catch, filtering on
DEBOUNCE_CANCELED_ERROR_MESSAGE to distinguish cancellation from a real error).
Fire-and-forget callers that ignore the returned promise will get an unhandled promise
rejection when cancel() runs.
Run the pending debounced invocation NOW (synchronously, with the most recently passed arguments) instead of waiting out the remaining delay, and clear the timer so it does not fire a second time.
Useful at lifecycle boundaries where the trailing window would otherwise lose the final invocation (unmount, blur, pagehide) or run it against changed context (see the platform-scripture-editor extension's debounced PDP save).
A debounced function with
cancelandflushmethods to abandon or immediately run any pending invocation (lodash-style lifecycle controls).