diff options
author | 2023-07-27 22:28:28 -0700 | |
---|---|---|
committer | 2023-07-27 22:28:28 -0700 | |
commit | 70b9bf743c21484b35918bb07ff2423f77207d2e (patch) | |
tree | 0328c61468c339bdcdb008f78ca1e887b330be1b /src/bun.js/bindings/ZigGlobalObject.cpp | |
parent | f3153fbee9246c1a39e2eaafe115e104d78d8c64 (diff) | |
download | bun-70b9bf743c21484b35918bb07ff2423f77207d2e.tar.gz bun-70b9bf743c21484b35918bb07ff2423f77207d2e.tar.zst bun-70b9bf743c21484b35918bb07ff2423f77207d2e.zip |
Add `Bun.isMainThread`
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 746412d78..b853f585e 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -4454,6 +4454,16 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm { + JSC::Identifier identifier = JSC::Identifier::fromString(vm, "isMainThread"_s); + object->putDirect(vm, identifier, + jsBoolean(scriptExecutionContext()->isMainThread()), + JSC::PropertyAttribute::DontDelete + | JSC::PropertyAttribute::ReadOnly + | 0); + } + + { + JSC::Identifier identifier = JSC::Identifier::fromString(vm, pathToFileURLString); object->putDirectNativeFunction(vm, this, identifier, 1, functionPathToFileURL, ImplementationVisibility::Public, NoIntrinsic, JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); |