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

Function throwInLoop

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

Source from the content-addressed store, hash-verified

103}
104
105async function throwInLoop() {
106 const ee = new EventEmitter();
107 const _err = new Error('kaboom');
108
109 process.nextTick(() => {
110 ee.emit('foo', 42);
111 });
112
113 try {
114 for await (const event of on(ee, 'foo')) {
115 assert.deepStrictEqual(event, [42]);
116 throw _err;
117 }
118 } catch (err) {
119 assert.strictEqual(err, _err);
120 }
121
122 assert.strictEqual(ee.listenerCount('foo'), 0);
123 assert.strictEqual(ee.listenerCount('error'), 0);
124}
125
126async function next() {
127 const ee = new EventEmitter();

Callers

nothing calls this directly

Calls 3

listenerCountMethod · 0.80
onFunction · 0.50
emitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…