WritableStreamDefaultWriter: closed property
Note: This feature is available in Web Workers.
The closed
read-only property of the
WritableStreamDefaultWriter
interface returns a
Promise
that fulfills if the stream becomes closed, or rejects if
the stream errors or the writer's lock is released.
Value
A Promise
.
Examples
js
const writableStream = new WritableStream(
{
start(controller) {},
write(chunk, controller) {
// ...
},
close(controller) {
// ...
},
abort(err) {
// ...
},
},
queuingStrategy,
);
// ...
const writer = writableStream.getWriter();
// ..
// check if the stream is closed
writer.closed.then(() => {
console.log("writer closed");
});
Specifications
Specification |
---|
Streams # ref-for-default-writer-closed② |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.