diff options
Diffstat (limited to 'src/io/readablestream.nim')
-rw-r--r-- | src/io/readablestream.nim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/io/readablestream.nim b/src/io/readablestream.nim new file mode 100644 index 00000000..16a650e2 --- /dev/null +++ b/src/io/readablestream.nim @@ -0,0 +1,32 @@ +#TODO.... + +type + UnderlyingSourceStartCallback = proc(controller: ReadableStreamController): + Option[JSValue] # may be undefined! + UnderlyingSourcePullCallback = proc(controller: ReadableStreamController): + EmptyPromise + UnderlyingSourceCancelCallback = proc(reason = none(JSValue)): EmptyPromise + + ReadableStreamType = enum + BYOB = "byob" + + UnderlyingSource* = object + start*: Option[UnderlyingSourceStartCallback] + pull*: Option[UnderlyingSourcePullCallback] + cancel*: Option[UnderlyingSourcePullCallback] + #TODO mark real name being type + ctype*: Option[ReadableStreamType] + + QueuingStrategySize = proc(chunk: JSValue): float64 # unrestricted + + QueuingStrategy* = object + highWaterMark*: float64 # unrestricted + size*: QueuingStrategySize + + ReadableStream* = object + underlyingSource: UnderlyingSource + +proc newReadableStream(underlyingSource = none(UnderlyingSource), + strategy = none(QueuingStrategySize)): ReadableStream = + let this = ReadableStream() + discard |