gossamer/abort_signal
Types
A signal that communicates when an operation should be aborted.
Used with fetch, streams, and other cancellable operations.
See AbortSignal on MDN.
pub type AbortSignal
Values
pub fn abort(reason: r) -> AbortSignal
pub fn any(signals: List(AbortSignal)) -> AbortSignal
pub fn is_aborted(signal: AbortSignal) -> Bool
pub fn on_abort(
signal: AbortSignal,
run handler: fn() -> a,
) -> Nil
pub fn reason(
for signal: AbortSignal,
) -> Result(dynamic.Dynamic, Nil)
The reason the signal was aborted with, or Error(Nil) if the signal
is not aborted.
pub fn throw_if_aborted(
signal: AbortSignal,
) -> Result(Nil, js_error.JsError)
Returns Error with the abort reason if the signal is aborted, or
Ok(Nil) otherwise.
pub fn timeout(
milliseconds: Int,
) -> Result(AbortSignal, js_error.JsError)
Creates an AbortSignal that aborts automatically after milliseconds.
Returns an error if milliseconds is negative. Some runtimes (Node)
also reject values that don’t fit in an unsigned 32-bit integer;
others (Deno) clamp them silently.