From 70b9bf743c21484b35918bb07ff2423f77207d2e Mon Sep 17 00:00:00 2001
From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Date: Thu, 27 Jul 2023 22:28:28 -0700
Subject: Add `Bun.isMainThread`
---
src/bun.js/bindings/ZigGlobalObject.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
(limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
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
@@ -4452,6 +4452,16 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm
| 0);
}
+ {
+
+ 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);
--
cgit v1.2.3
o/fetch-fix-with-lock'>ciro/fetch-fix-with-lock
Unnamed repository; edit this file 'description' to name the repository. | |