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

Function onceWithEventTarget

test/parallel/test-events-once.js:123–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121}
122
123async function onceWithEventTarget() {
124 const et = new EventTarget();
125 const event = new Event('myevent');
126 process.nextTick(() => {
127 et.dispatchEvent(event);
128 });
129 const [ value ] = await once(et, 'myevent');
130 assert.strictEqual(value, event);
131}
132
133async function onceWithEventTargetError() {
134 const et = new EventTarget();

Callers 1

Calls 2

dispatchEventMethod · 0.95
onceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…