mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
feat(ext/web): implement AbortSignal.prototype.throwIfAborted()
(#13044)
See whatwg/dom#1034.
This commit is contained in:
parent
2926827726
commit
0f0dd5b7ec
3 changed files with 13 additions and 10 deletions
|
@ -85,6 +85,13 @@
|
||||||
webidl.assertBranded(this, AbortSignal);
|
webidl.assertBranded(this, AbortSignal);
|
||||||
return this[abortReason];
|
return this[abortReason];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throwIfAborted() {
|
||||||
|
webidl.assertBranded(this, AbortSignal);
|
||||||
|
if (this[abortReason] !== undefined) {
|
||||||
|
throw this[abortReason];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defineEventHandler(AbortSignal.prototype, "abort");
|
defineEventHandler(AbortSignal.prototype, "abort");
|
||||||
|
|
||||||
|
|
4
ext/web/lib.deno_web.d.ts
vendored
4
ext/web/lib.deno_web.d.ts
vendored
|
@ -293,6 +293,10 @@ interface AbortSignal extends EventTarget {
|
||||||
listener: EventListenerOrEventListenerObject,
|
listener: EventListenerOrEventListenerObject,
|
||||||
options?: boolean | EventListenerOptions,
|
options?: boolean | EventListenerOptions,
|
||||||
): void;
|
): void;
|
||||||
|
|
||||||
|
/** Throws this AbortSignal's abort reason, if its AbortController has
|
||||||
|
* signaled to abort; otherwise, does nothing. */
|
||||||
|
throwIfAborted(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare var AbortSignal: {
|
declare var AbortSignal: {
|
||||||
|
|
|
@ -4799,16 +4799,8 @@
|
||||||
"abort": {
|
"abort": {
|
||||||
"AbortSignal.any.html": true,
|
"AbortSignal.any.html": true,
|
||||||
"AbortSignal.any.worker.html": true,
|
"AbortSignal.any.worker.html": true,
|
||||||
"event.any.html": [
|
"event.any.html": true,
|
||||||
"throwIfAborted() should throw abort.reason if signal aborted",
|
"event.any.worker.html": true
|
||||||
"throwIfAborted() should throw primitive abort.reason if signal aborted",
|
|
||||||
"throwIfAborted() should not throw if signal not aborted"
|
|
||||||
],
|
|
||||||
"event.any.worker.html": [
|
|
||||||
"throwIfAborted() should throw abort.reason if signal aborted",
|
|
||||||
"throwIfAborted() should throw primitive abort.reason if signal aborted",
|
|
||||||
"throwIfAborted() should not throw if signal not aborted"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"events": {
|
"events": {
|
||||||
"AddEventListenerOptions-once.any.html": [
|
"AddEventListenerOptions-once.any.html": [
|
||||||
|
|
Loading…
Add table
Reference in a new issue