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

Function nodeEventTarget

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

Source from the content-addressed store, hash-verified

248}
249
250async function nodeEventTarget() {
251 const et = new NodeEventTarget();
252 const tick = () => et.dispatchEvent(new Event('tick'));
253 const interval = setInterval(tick, 0);
254 let count = 0;
255 for await (const [ event] of on(et, 'tick')) {
256 count++;
257 assert.strictEqual(event.type, 'tick');
258 if (count >= 5) {
259 break;
260 }
261 }
262 assert.strictEqual(count, 5);
263 clearInterval(interval);
264}
265
266async function abortableOnBefore() {
267 const ee = new EventEmitter();

Callers

nothing calls this directly

Calls 3

clearIntervalFunction · 0.85
setIntervalFunction · 0.50
onFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…