aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/modules/EventsModule.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/modules/EventsModule.h')
-rw-r--r--src/bun.js/modules/EventsModule.h11
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(