ReadableStream: locked property
Note: This feature is available in Web Workers.
The locked
read-only property of the ReadableStream
interface returns whether or not the readable stream is locked to a reader.
A readable stream can have at most one active reader at a time, and is locked to that reader until it is released.
A reader might be obtained using ReadableStream.getReader()
and released using the reader's releaseLock()
method.
Value
A boolean value indicating whether or not the readable stream is locked.
Examples
js
const stream = new ReadableStream({
// ...
});
const reader = stream.getReader();
stream.locked;
// should return true, as the stream has been locked to a reader
Specifications
Specification |
---|
Streams # ref-for-rs-locked② |
Browser compatibility
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.
See also
ReadableStream()
constructor- Using readable streams