From 3fceae807037d97cd6c93d20d87d1ef5a98fdd75 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Wed, 12 Oct 2022 23:46:15 -0700 Subject: Implement `ReadableStream.prototype[Symbol.asyncIterator]` cc @fabiancook --- src/bun.js/builtins/js/ReadableStream.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/bun.js/builtins/js/ReadableStream.js') diff --git a/src/bun.js/builtins/js/ReadableStream.js b/src/bun.js/builtins/js/ReadableStream.js index 42c0fbdbc..8020b024d 100644 --- a/src/bun.js/builtins/js/ReadableStream.js +++ b/src/bun.js/builtins/js/ReadableStream.js @@ -443,3 +443,24 @@ function locked() return @isReadableStreamLocked(this); } + +function values(options) { + "use strict"; + var prototype = this?.constructor?.prototype; + if (!prototype) { + return @undefined; + } + @readableStreamDefineLazyIterators(prototype); + return prototype.values.@call(this, options); +} + +@linkTimeConstant +function lazyAsyncIterator() { + "use strict"; + var prototype = this?.constructor?.prototype; + if (!prototype) { + return @undefined; + } + @readableStreamDefineLazyIterators(prototype); + return prototype[globalThis.Symbol.asyncIterator].@call(this); +} \ No newline at end of file -- cgit v1.2.3