mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 13:14:48 +00:00
feat(op_crates/web) EventTarget signal support (#8616)
Fixes: https://github.com/denoland/deno/issues/8606
This commit is contained in:
parent
ae21a9569b
commit
71ef5a9cd3
3 changed files with 35 additions and 3 deletions
|
|
@ -106,6 +106,25 @@ function eventIsTrustedGetterName() {
|
|||
assert(e.message.includes("not a constructor"));
|
||||
}
|
||||
}
|
||||
function eventAbortSignal() {
|
||||
let count = 0;
|
||||
function handler() {
|
||||
count++;
|
||||
}
|
||||
const et = new EventTarget();
|
||||
const controller = new AbortController();
|
||||
et.addEventListener("test", handler, { signal: controller.signal });
|
||||
et.dispatchEvent(new Event("test"));
|
||||
assert(count === 1);
|
||||
et.dispatchEvent(new Event("test"));
|
||||
assert(count === 2);
|
||||
controller.abort();
|
||||
et.dispatchEvent(new Event("test"));
|
||||
assert(count === 2);
|
||||
et.addEventListener("test", handler, { signal: controller.signal });
|
||||
et.dispatchEvent(new Event("test"));
|
||||
assert(count === 2);
|
||||
}
|
||||
function main() {
|
||||
eventInitializedWithType();
|
||||
eventInitializedWithTypeAndDict();
|
||||
|
|
@ -116,6 +135,7 @@ function main() {
|
|||
eventInitializedWithNonStringType();
|
||||
eventIsTrusted();
|
||||
eventIsTrustedGetterName();
|
||||
eventAbortSignal();
|
||||
}
|
||||
|
||||
main();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue