AbortSignal Class

https://dom.spec.whatwg.org/#interface-AbortSignal

public class AbortSignal : EventTarget
Inheritance
EventTarget AbortSignal

Properties

NameDescription
AbortedGets a value indicating whether the signal has been aborted.
OnAbortGets or sets the event handler of the abort event.
ReasonGets the reason the signal was aborted, or null when it is not aborted.

Gets a value indicating whether the signal has been aborted.

public bool Aborted { get; }

Gets or sets the event handler of the abort event.

public Action<Event>? OnAbort { get; set; }

Gets the reason the signal was aborted, or null when it is not aborted.

public object? Reason { get; }

Methods

NameDescription
Abort(object?)https://dom.spec.whatwg.org/#dom-abortsignal-abort
Any(IEnumerable<AbortSignal>)https://dom.spec.whatwg.org/#dom-abortsignal-any
ThrowIfAborted()https://dom.spec.whatwg.org/#dom-abortsignal-throwifaborted
Timeout(GlobalScope, ulong)https://dom.spec.whatwg.org/#dom-abortsignal-timeout: returns a signal aborted after milliseconds, measured by the timers of the event loop of window.
Timeout(ulong)https://dom.spec.whatwg.org/#dom-abortsignal-timeout: the timer runs on the event loop of the current global object (the window or the worker of the running script). Without one, the signal is never aborted: use AbortSignal.Timeout.

Abort(object?)

AbortSignal.cs

https://dom.spec.whatwg.org/#dom-abortsignal-abort

public static AbortSignal Abort(object? reason = null)

Any(IEnumerable<AbortSignal>)

AbortSignal.cs

https://dom.spec.whatwg.org/#dom-abortsignal-any

public static AbortSignal Any(IEnumerable<AbortSignal> signals)

ThrowIfAborted()

AbortSignal.cs

https://dom.spec.whatwg.org/#dom-abortsignal-throwifaborted

public void ThrowIfAborted()

Timeout overloads

Timeout(GlobalScope, ulong)

AbortSignal.cs

https://dom.spec.whatwg.org/#dom-abortsignal-timeout: returns a signal aborted after milliseconds, measured by the timers of the event loop of window.

public static AbortSignal Timeout(GlobalScope window, ulong milliseconds)
Parameters
window GlobalScope
milliseconds ulong
Returns

AbortSignal

Timeout(ulong)

AbortSignal.cs

https://dom.spec.whatwg.org/#dom-abortsignal-timeout: the timer runs on the event loop of the current global object (the window or the worker of the running script). Without one, the signal is never aborted: use AbortSignal.Timeout.

public static AbortSignal Timeout(ulong milliseconds)