diff options
author | 2023-04-07 02:20:12 -0500 | |
---|---|---|
committer | 2023-04-07 02:20:12 -0500 | |
commit | d115f278def29c9330c84cd51b1bd84921ece897 (patch) | |
tree | 5f8577a184cbd0ea5f6bd55b3f3f14aa823527ae /src/bun.js/modules | |
parent | f3d593c9bdeb163b556d292020669e2755580bc6 (diff) | |
download | bun-derrick/fix/event-emitter-async-iter.tar.gz bun-derrick/fix/event-emitter-async-iter.tar.zst bun-derrick/fix/event-emitter-async-iter.zip |
fix(node:events): correct `node:events.once`, add testsderrick/fix/event-emitter-async-iter
Diffstat (limited to 'src/bun.js/modules')
-rw-r--r-- | src/bun.js/modules/EventsModule.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/bun.js/modules/EventsModule.h b/src/bun.js/modules/EventsModule.h index e60624ac9..15981fcca 100644 --- a/src/bun.js/modules/EventsModule.h +++ b/src/bun.js/modules/EventsModule.h @@ -24,10 +24,6 @@ inline void generateEventsSourceCode(JSC::JSGlobalObject *lexicalGlobalObject, exportValues.append(JSC::JSFunction::create( vm, lexicalGlobalObject, 0, MAKE_STATIC_STRING_IMPL("listenerCount"), Events_functionListenerCount, ImplementationVisibility::Public)); - exportNames.append(JSC::Identifier::fromString(vm, "once"_s)); - exportValues.append(JSC::JSFunction::create( - vm, lexicalGlobalObject, 0, MAKE_STATIC_STRING_IMPL("once"), - Events_functionOnce, ImplementationVisibility::Public)); exportNames.append( JSC::Identifier::fromString(vm, "captureRejectionSymbol"_s)); exportValues.append(Symbol::create( @@ -48,6 +44,13 @@ inline void generateEventsSourceCode(JSC::JSGlobalObject *lexicalGlobalObject, PropertyAttribute::Builtin | PropertyAttribute::DontDelete); exportValues.append(onAsyncIterFnPtr); + exportNames.append(JSC::Identifier::fromString(vm, "once"_s)); + auto *oncePromiseFnPtr = eventEmitterModuleCJS->putDirectBuiltinFunction( + vm, globalObject, JSC::Identifier::fromString(vm, "once"_s), + nodeEventsOncePromiseCodeGenerator(vm), + PropertyAttribute::Builtin | PropertyAttribute::DontDelete); + exportValues.append(oncePromiseFnPtr); + eventEmitterModuleCJS->putDirect( vm, PropertyName( |