aboutsummaryrefslogtreecommitdiff
path: root/src/js/builtins/ReadableStream.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/ReadableStream.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/ReadableStream.ts')
-rw-r--r--src/js/builtins/ReadableStream.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/js/builtins/ReadableStream.ts b/src/js/builtins/ReadableStream.ts
index 08131130d..5a5b7e119 100644
--- a/src/js/builtins/ReadableStream.ts
+++ b/src/js/builtins/ReadableStream.ts
@@ -24,7 +24,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-export function initializeReadableStream(this: any, underlyingSource: UnderlyingSource, strategy: any) {
+export function initializeReadableStream(
+ this: ReadableStream,
+ underlyingSource: UnderlyingSource,
+ strategy: QueuingStrategy,
+) {
if (underlyingSource === undefined)
underlyingSource = { $bunNativeType: 0, $bunNativePtr: 0, $lazy: false } as UnderlyingSource;
if (strategy === undefined) strategy = {};
@@ -47,6 +51,8 @@ export function initializeReadableStream(this: any, underlyingSource: Underlying
$putByIdDirectPrivate(this, "bunNativeType", $getByIdDirectPrivate(underlyingSource, "bunNativeType") ?? 0);
$putByIdDirectPrivate(this, "bunNativePtr", $getByIdDirectPrivate(underlyingSource, "bunNativePtr") ?? 0);
+ $putByIdDirectPrivate(this, "asyncContext", $getInternalField($asyncContext, 0));
+
const isDirect = underlyingSource.type === "direct";
// direct streams are always lazy
const isUnderlyingSourceLazy = !!underlyingSource.$lazy;