A TimeoutCancellationToken automatically requests cancellation after the timeout has elapsed.
|int||$timeout||Milliseconds until cancellation is requested.||none|
Cancels the delay watcher.
Subscribes a new handler to be invoked on a cancellation request.
This handler might be invoked immediately in case the token has already been cancelled. Returned generators will automatically be run as coroutines. Any unhandled exceptions will be throw into the event loop.
|callable||$callback||Callback to be invoked on a cancellation request. Will receive a `CancelledException` as first argument that may be used to fail the operation's promise.||none|
Unsubscribes a previously registered handler.
The handler will no longer be called as long as this method isn't invoked from a subscribed callback.
Returns whether cancellation has been requested yet.
CancelledException if cancellation has been requested, otherwise does nothing.