ReadableStreamBYOBReader: closed プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
closed
は ReadableStreamBYOBReader
インターフェイスの読み取り専用プロパティで、ストリームが閉じられた場合、またはリーダーのロックが解除された場合に履行され、ストリームがエラーの場合は拒否されるプロミスを返します。
このプロパティにより、ストリーミング処理の終わりに応答するコードを書くことができます。
値
Promise
です。
例
下記コードは BYOBReader の閉じられたかエラーかの状態を処理するパターンを示します。
js
const reader = stream.getReader({ mode: "byob" });
reader.closed
.then(() => {
// 解決 - ストリームを閉じるコード
})
.catch(() => {
// 拒否 - エラーを扱うコード
});
仕様書
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
- No support
- No 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.