ReadableStreamDefaultReader: closed プロパティ
closed
は ReadableStreamDefaultReader
インターフェイスの読み取り専用プロパティで、ストリームが閉じられた場合、またはリーダーのロックが解除された場合に履行され、ストリームがエラーの場合に拒否されるプロミス (Promise
) を返します。このプロパティを使用すると、ストリーミング処理の終わりに応答するコードを書くことができます。
値
Promise
です。
例
このスニペットでは、以前に作成したリーダーに問い合わせて、ストリームが閉じられているかどうかを確認します。 閉じられるとプロミスが履行され、メッセージをコンソールに出力します。
js
reader.closed.then(() => {
console.log("reader closed");
});
仕様書
Specification |
---|
Streams # ref-for-generic-reader-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.