aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGlobalObject.cpp
diff options
context:
space:
mode:
authorGravatar Zilin Zhu <zhuzilinallen@gmail.com> 2022-09-09 10:52:27 +0800
committerGravatar GitHub <noreply@github.com> 2022-09-08 19:52:27 -0700
commit8d8b72cf3f7119f0bc018513d89eca5f8ec44ab3 (patch)
treeb7af0511edfb0ca115a4f28f43a8be0f14ae63d8 /src/bun.js/bindings/ZigGlobalObject.cpp
parenta3cc9aaf6f66bac85e6318d3e09c0f1961d18210 (diff)
downloadbun-8d8b72cf3f7119f0bc018513d89eca5f8ec44ab3.tar.gz
bun-8d8b72cf3f7119f0bc018513d89eca5f8ec44ab3.tar.zst
bun-8d8b72cf3f7119f0bc018513d89eca5f8ec44ab3.zip
Add native helper functions for Readable and convert ReadableState properties to getter/setter (#1218)
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index 1cedb04cc..012ad2d66 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -89,6 +89,7 @@
#include "JSFetchHeaders.h"
#include "JSStringDecoder.h"
#include "JSReadableState.h"
+#include "JSReadableHelper.h"
#include "Process.h"
@@ -1042,6 +1043,15 @@ JSC:
auto* obj = constructEmptyObject(globalObject);
obj->putDirect(vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "BufferList"_s)), reinterpret_cast<Zig::GlobalObject*>(globalObject)->JSBufferList(), 0);
obj->putDirect(vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "ReadableState"_s)), reinterpret_cast<Zig::GlobalObject*>(globalObject)->JSReadableState(), 0);
+ obj->putDirect(
+ vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "maybeReadMore"_s)),
+ JSC::JSFunction::create(vm, globalObject, 0, "maybeReadMore"_s, jsReadable_maybeReadMore, ImplementationVisibility::Public), 0);
+ obj->putDirect(
+ vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "resume"_s)),
+ JSC::JSFunction::create(vm, globalObject, 0, "resume"_s, jsReadable_resume, ImplementationVisibility::Public), 0);
+ obj->putDirect(
+ vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "emitReadable_"_s)),
+ JSC::JSFunction::create(vm, globalObject, 0, "emitReadable_"_s, jsReadable_emitReadable_, ImplementationVisibility::Public), 0);
return JSValue::encode(obj);
}