MCPcopy Index your code
hub / github.com/nodejs/node / eventTargetAbortableOnAfter

Function eventTargetAbortableOnAfter

test/parallel/test-events-on-async-iterator.js:313–332  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

311}
312
313async function eventTargetAbortableOnAfter() {
314 const et = new EventTarget();
315 const ac = new AbortController();
316
317 const i = setInterval(() => et.dispatchEvent(new Event('foo')), 10);
318
319 async function foo() {
320 for await (const f of on(et, 'foo', { signal: ac.signal })) {
321 assert(f);
322 }
323 }
324
325 foo().catch(common.mustCall((error) => {
326 assert.strictEqual(error.name, 'AbortError');
327 })).finally(() => {
328 clearInterval(i);
329 });
330
331 process.nextTick(() => ac.abort());
332}
333
334async function eventTargetAbortableOnAfter2() {
335 const et = new EventTarget();

Callers

nothing calls this directly

Calls 5

dispatchEventMethod · 0.95
abortMethod · 0.95
clearIntervalFunction · 0.85
fooFunction · 0.70
setIntervalFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…