@caido/quickjs-types / llrt/abort
llrt/abort
Classes
AbortController
Constructors
new AbortController()
new AbortController():
AbortController
Creates a new AbortController
object instance.
Returns
Properties
signal
readonly
signal:AbortSignal
Returns the AbortSignal object associated with this object.
Methods
abort()
abort(
reason
?:any
):void
Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
Parameters
Parameter | Type |
---|---|
reason ? | any |
Returns
void
AbortSignal
A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.
Extends
Constructors
new AbortSignal()
new AbortSignal():
AbortSignal
Creates a new AbortSignal
object instance.
Returns
Overrides
Properties
aborted
readonly
aborted:boolean
Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
onabort
onabort:
null
| (this
:AbortSignal
,event
:Event
) =>any
Registers an event listener callback to execute when an abort
event is observed.
reason
readonly
reason:any
A JavaScript value providing the abort reason, once the signal has aborted.
Methods
addEventListener()
addEventListener(
type
:EventKey
,listener
:EventListener
,options
?:AddEventListenerOptions
):void
Adds a new handler for the type
event. Any given listener
is added only once per type
.
If the once
option is true, the listener
is removed after the next time a type
event is dispatched.
Parameters
Parameter | Type |
---|---|
type | EventKey |
listener | EventListener |
options ? | AddEventListenerOptions |
Returns
void
Inherited from
dispatchEvent()
dispatchEvent(
event
:Event
):void
Dispatches a synthetic event event to target
Parameters
Parameter | Type |
---|---|
event | Event |
Returns
void
Inherited from
removeEventListener()
removeEventListener(
type
:EventKey
,listener
:EventListener
):void
Removes the event listener in target's event listener list with the same type and callback
Parameters
Parameter | Type |
---|---|
type | EventKey |
listener | EventListener |
Returns
void
Inherited from
EventTarget
.removeEventListener
throwIfAborted()
throwIfAborted():
void
Throws the signal's abort reason if the signal has been aborted; otherwise it does nothing.
Returns
void
abort()
static
abort(reason
?:any
):AbortSignal
Returns an AbortSignal
instance that is already set as aborted.
Parameters
Parameter | Type | Description |
---|---|---|
reason ? | any | The reason for the abort. |
Returns
any()
static
any(signals
:AbortSignal
[]):AbortSignal
Returns an AbortSignal
that aborts when any of the given abort signals abort.
Parameters
Parameter | Type | Description |
---|---|---|
signals | AbortSignal [] | An array of AbortSignal objects to observe. |
Returns
timeout()
static
timeout(milliseconds
:number
):AbortSignal
Returns an AbortSignal
instance that will automatically abort after a specified time.
Parameters
Parameter | Type | Description |
---|---|---|
milliseconds | number | The number of milliseconds to wait before aborting. |