Liking cljdoc? Tell your friends :D

web.streams.WritableStream

The WritableStream interface of the the Streams API provides standard abstraction for writing streaming data to a destination, as a sink. This object comes with built-in backpressure and queuing.

The WritableStream interface of the the Streams API provides
standard abstraction for writing streaming data to a destination,
as a sink. This object comes with built-in backpressure and queuing.
raw docstring

abortcljs

(abort this reason)

Method.

[Draft] [Experimental]

The abort() method of the web.streams.WritableStream interface the stream, signaling that the producer can no longer successfully to the stream and it is to be immediately moved to an error state, any queued writes discarded.

Promise<reason> writableStreamInstance.abort(reason);

See also: https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort

Method.

[Draft]
[Experimental]

The abort() method of the `web.streams.WritableStream` interface
the stream, signaling that the producer can no longer successfully
to the stream and it is to be immediately moved to an error state,
any queued writes discarded.

`Promise<reason> writableStreamInstance.abort(reason);`

See also: `https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort`
sourceraw docstring

constructorcljs

(constructor & args)

Constructor.

The WritableStream() constructor creates a new web.streams.WritableStream object instance.

underlyingSink \tAn object containing methods and properties that define how the constructed stream instance will behave. underlyingSink can contain the following:

\t\tstart(controller) Optional \t\tThis is a method, called immediately when the object is constructed. The contents of this method are defined by the developer, and should aim to get access to the underlying sink. If this process is to be done asynchronously, it can return a promise to signal success or failure. The controller parameter passed to this method is a web.fetch.WritableStreamDefaultController. This can be used by the developer to control the stream during set up. \t\twrite(chunk, controller) Optional \t\tThis method, also defined by the developer, will be called when a new chunk of data (specified in the chunk parameter) is ready to be written to the underlying sink. It can return a promise to signal success or failure of the write operation. The controller parameter passed to this method is a web.fetch.WritableStreamDefaultController that can be used by the developer to control the stream as more chunks are submitted for writing. This method will be called only after previous writes have succeeded, and never after the stream is closed or aborted (see below). \t\tclose(controller) Optional \t\tThis method, also defined by the developer, will be called if the app signals that it has finished writing chunks to the stream. The contents should do whatever is necessary to finalize writes to the underlying sink, and release access to it. If this process is asynchronous, it can return a promise to signal success or failure. This method will be called only after all queued-up writes have succeeded. The controller parameter passed to this method is a web.fetch.WritableStreamDefaultController, which can be used to control the stream at the end of writing. \t\tabort(reason) Optional \t\tThis method, also defined by the developer, will be called if the app signals that it wishes to abruptly close the stream and put it in an errored state. It can clean up any held resources, much like close(), but abort() will be called even if writes are queued up — those chunks will be thrown away. If this process is asynchronous, it can return a promise to signal success or failure. The reason parameter contains a web.DOMString describing why the stream was aborted.

\tqueuingStrategy Optional \tAn object that optionally defines a queueing strategy for the stream. This takes two parameters:

\t\thighWaterMark \t\tA non-negative integer — this defines the total number of chunks that can be contained in the internal queue before backpressure is applied. \t\tsize(chunk) \t\tA method containing a parameter chunk — this indicates the size to use for each chunk, in bytes.

\tNote: You could define your own custom queuingStrategy, or use an instance of ByteLengthQueueingStrategy or CountQueueingStrategy for this object value. If no queuingStrategy is supplied, the default used is the same as a CountQueuingStrategy with a high water mark of 1.

See also: https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/WritableStream

Constructor.

The WritableStream() constructor creates a new `web.streams.WritableStream` object instance.

underlyingSink
\tAn object containing methods and properties that define how the constructed stream instance will behave. underlyingSink can contain the following:

\t\tstart(controller) Optional
\t\tThis is a method, called immediately when the object is constructed. The contents of this method are defined by the developer, and should aim to get access to the underlying sink. If this process is to be done asynchronously, it can return a promise to signal success or failure. The controller parameter passed to this method is a `web.fetch.WritableStreamDefaultController`. This can be used by the developer to control the stream during set up.
\t\twrite(chunk, controller) Optional
\t\tThis method, also defined by the developer, will be called when a new chunk of data (specified in the chunk parameter) is ready to be written to the underlying sink. It can return a promise to signal success or failure of the write operation. The controller parameter passed to this method is a `web.fetch.WritableStreamDefaultController` that can be used by the developer to control the stream as more chunks are submitted for writing. This method will be called only after previous writes have succeeded, and never after the stream is closed or aborted (see below).
\t\tclose(controller) Optional
\t\tThis method, also defined by the developer, will be called if the app signals that it has finished writing chunks to the stream. The contents should do whatever is necessary to finalize writes to the underlying sink, and release access to it. If this process is asynchronous, it can return a promise to signal success or failure. This method will be called only after all queued-up writes have succeeded. The controller parameter passed to this method is a `web.fetch.WritableStreamDefaultController`, which can be used to control the stream at the end of writing.
\t\tabort(reason) Optional
\t\tThis method, also defined by the developer, will be called if the app signals that it wishes to abruptly close the stream and put it in an errored state. It can clean up any held resources, much like close(), but abort() will be called even if writes are queued up — those chunks will be thrown away. If this process is asynchronous, it can return a promise to signal success or failure. The reason parameter contains a `web.DOMString` describing why the stream was aborted.


\tqueuingStrategy Optional
\tAn object that optionally defines a queueing strategy for the stream. This takes two parameters:

\t\thighWaterMark
\t\tA non-negative integer — this defines the total number of chunks that can be contained in the internal queue before backpressure is applied.
\t\tsize(chunk)
\t\tA method containing a parameter chunk — this indicates the size to use for each chunk, in bytes.



\tNote: You could define your own custom queuingStrategy, or use an instance of `ByteLengthQueueingStrategy` or `CountQueueingStrategy` for this object value. If no queuingStrategy is supplied, the default used is the same as a CountQueuingStrategy with a high water mark of 1.

See also: `https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/WritableStream`
sourceraw docstring

get-writercljs

(get-writer this)

Method.

[Draft] [Experimental]

The getWriter() method of the web.streams.WritableStream interface a new instance of web.streams.WritableStreamDefaultWriter and the stream to that instance. While the stream is locked, no other can be acquired until this one is released.

var writer = writableStreamInstance.getWriter();

See also: https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/getWriter

Method.

[Draft]
[Experimental]

The getWriter() method of the `web.streams.WritableStream` interface
a new instance of `web.streams.WritableStreamDefaultWriter` and
the stream to that instance. While the stream is locked, no other
can be acquired until this one is released.

`var writer = writableStreamInstance.getWriter();`

See also: `https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/getWriter`
sourceraw docstring

lockedcljs

(locked this)

Property.

[Read Only] [Draft] [Experimental]

The locked getter property of the web.streams.WritableStream returns a boolean indicating whether the WritableStream is locked a writer.

var locked = writableStreamInstance.locked;

See also: https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/locked

Property.

[Read Only]
[Draft]
[Experimental]

The locked getter property of the `web.streams.WritableStream`
returns a boolean indicating whether the WritableStream is locked
a writer.

`var locked = writableStreamInstance.locked;`

See also: `https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/locked`
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close