ReadableStream: locked プロパティ
locked
は ReadableStream
インターフェイスの読み取り専用プロパティで、読み取り可能なストリームがリーダーにロックされているかどうかを返します。
読み取り可能なストリームは、一度に最大 1 つのアクティブなリーダーを持つことができ、それが解放されるまでそのリーダーにロックされます。
リーダーは ReadableStream.getReader()
を使用して取得し、リーダーの releaseLock()
メソッドを使用して解放することができます。
値
論理値で、読み取り可能なストリームがロックされているかどうかを示します。
例
js
const stream = new ReadableStream({
// ...
});
const reader = stream.getReader();
stream.locked;
// ストリームがリーダーにロックされているため、true が返されるはずです
仕様書
Specification |
---|
Streams # ref-for-rs-locked② |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
locked |
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.
関連情報
ReadableStream()
constructor- 読み取り可能なストリームの使用