Skip to content

AbortSignal

Generated from idl/dom.webidl when the site was built at 7aa23e2.

AbortSignal is an interface in idl/dom.webidl, inheriting EventTarget, exposed in Window, Worker. What it does is on MDN; this page says what niso has of it.

timeout() and any() are the binding’s: timeout() waits on the DOM’s timers and makes its TimeoutError when the timer fires, and any() reads its signals and builds the result with create() and addSource().

The web features its members belong to, each with its Baseline status on the web and how much of the feature’s WPT suite passes in niso (see Web platform support).

Feature On the web In niso Members
AbortController and AbortSignal Widely available Partial 97% 70 of 72 subtests pass 5
static operation
[NewObject] static AbortSignal abort(optional [NisoHeld] any reason);
int32_t niso_abort_signal_abort(niso_dom* dom, niso_held reason, niso_handle* out);
attribute
readonly attribute boolean aborted;
int32_t niso_abort_signal_get_aborted(niso_dom* dom, niso_handle self, bool* out);
attribute
readonly attribute [NisoHeld] any reason;
int32_t niso_abort_signal_get_reason(niso_dom* dom, niso_handle self, void** out);

Null until the signal is aborted; the JS binding reports undefined.

operation
undefined throwIfAborted();
int32_t niso_abort_signal_throw_if_aborted(niso_dom* dom, niso_handle self);
attribute
attribute EventHandler onabort;
int32_t niso_abort_signal_get_onabort(niso_dom* dom, niso_handle self, void** out);
int32_t niso_abort_signal_set_onabort(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);
static operation not in JS
[NisoInternal, NewObject] static AbortSignal create(boolean dependent);
int32_t niso_abort_signal_create(niso_dom* dom, bool dependent, niso_handle* out);

A new signal that is not aborted. DOM’s “create a dependent abort signal”, after its check for an already aborted signal, is a new dependent one, then addSource() with each signal in turn.

operation not in JS
[NisoInternal] undefined addSource(AbortSignal signal);
int32_t niso_abort_signal_add_source(niso_dom* dom, niso_handle self, niso_handle signal);
operation not in JS
[NisoInternal] unsigned long addAlgorithm(AbortAlgorithm algorithm);
int32_t niso_abort_signal_add_algorithm(niso_dom* dom, niso_handle self, niso_abort_algorithm_fn algorithm_fn, void* algorithm_userdata, niso_drop_fn algorithm_drop, uint32_t* out);

DOM’s “add” an abort algorithm, which runs before the abort event and gets the signal: its id for removeAlgorithm, or 0 when the signal can never abort and the algorithm is dropped.

static operation not in JS
[NisoInternal] static undefined removeAlgorithm(unsigned long id);
int32_t niso_abort_signal_remove_algorithm(niso_dom* dom, uint32_t id);

DOM’s “remove” an abort algorithm, from whichever signal holds it.

operation not in JS
[NisoInternal, NisoReentrant] undefined signalAbort(optional [NisoHeld] any reason);
int32_t niso_abort_signal_signal_abort(niso_dom* dom, niso_handle self, niso_held reason);

DOM’s “signal abort”.

Members the web has, by the BCD keys web-features 3.45.0 lists, that idl/ doesn’t declare. The list is partial: web-features lists only the keys it maps to a feature.

  • abort_static (AbortController and AbortSignal)
  • any_static (AbortSignal.any())
  • timeout_static (AbortSignal.timeout())