diff --git a/index.bs b/index.bs index 43149ff9..550da0ca 100644 --- a/index.bs +++ b/index.bs @@ -4064,6 +4064,7 @@ interface WritableStream { readonly attribute boolean locked; + Promise write(optional any chunk); Promise abort(optional any reason); Promise close(); WritableStreamDefaultWriter getWriter(); @@ -4270,6 +4271,17 @@ as seen for example in [[#example-ws-no-backpressure]].

Returns whether or not the writable stream is [=locked to a writer=]. +

await stream.{{WritableStream/write(chunk)|write}}([ chunk ]) +
+

Writes a [=chunk=] of data to the stream just like the {{WritableStreamDefaultWriter/write()}} + method. + +

This is a convenience method that first acquires a writer, queues the chunk to be written, + releases the writer (without waiting on the write to complete), and returns a promise that + fulfills if the write was successful, or reject if the write failed. Additionally, if the stream + is currently [=locked to a writer|locked=], a promise rejecting with a {{TypeError}} is returned, + and no attempt to write will be made. +

await stream.{{WritableStream/abort(reason)|abort}}([ reason ])

[=abort a writable stream|Aborts=] the stream, signaling that the producer can no longer @@ -4332,6 +4344,17 @@ as seen for example in [[#example-ws-no-backpressure]]. 1. Return ! [$IsWritableStreamLocked$]([=this=]). +

+ The write(|chunk|) method steps are: + + 1. Let |result| be ? [$AcquireWritableStreamDefaultWriter$]([=this=]). + 1. If |result| is an abrupt completion, return [=a promise rejected with=] |result|.\[[Value]]. + 1. Let |writer| be |result|.\[[Value]]. + 1. Let |writePromise| be ! [$WritableStreamDefaultWriterWrite$](|writer|, |chunk|). + 1. Perform ! [$WritableStreamDefaultWriterRelease$](|writer|). + 1. Return |writePromise|. +
+
The abort(|reason|) method steps are: