WritableStreamDefaultWriter.closed
WritableStreamDefaultWriter
接口的只读属性 closed
返回一个 Promise
,这个 promise 在流关闭时兑现,而在流抛出错误或者 writer 的锁被释放时拒绝。
值
一个 Promise
。
示例
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');
})
规范
Specification |
---|
Streams # ref-for-default-writer-closed② |
浏览器兼容性
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.