aboutsummaryrefslogtreecommitdiff
path: root/src/js/builtins/AsyncContext.ts
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-07-19 17:20:00 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-19 17:20:00 -0700
commit9b6dc49575df5fb953918c284505f24741138130 (patch)
tree3a052876fa8c6524e0c8d18479aabe38e2d5a52a /src/js/builtins/AsyncContext.ts
parent723e9d1ea7c7fdb424ecedd0fb023524366322c4 (diff)
downloadbun-9b6dc49575df5fb953918c284505f24741138130.tar.gz
bun-9b6dc49575df5fb953918c284505f24741138130.tar.zst
bun-9b6dc49575df5fb953918c284505f24741138130.zip
Implement `AsyncLocalStorage` (#3089)
* work to get async local storage working. * a * a * everything but queueMicrotask * sdfghj * . * finish * tests * test * ok * done * im so stupid * Upgrade WebKit * refactor * refactor * changes requested * oops * cool * fix runInAsyncScope
Diffstat (limited to 'src/js/builtins/AsyncContext.ts')
-rw-r--r--src/js/builtins/AsyncContext.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/js/builtins/AsyncContext.ts b/src/js/builtins/AsyncContext.ts
new file mode 100644
index 000000000..1c55feeba
--- /dev/null
+++ b/src/js/builtins/AsyncContext.ts
@@ -0,0 +1,9 @@
+// Used by async_hooks to manipulate the async context
+
+export function getAsyncContext(): ReadonlyArray<any> | undefined {
+ return $getInternalField($asyncContext, 0);
+}
+
+export function setAsyncContext(contextValue: ReadonlyArray<any> | undefined) {
+ return $putInternalField($asyncContext, 0, contextValue);
+}