Web APIs

ReadableStream.locked

Try the free JavaScript compiler

Report whether a reader or piping operation has locked the stream. A second independent reader cannot acquire the same lock. Example console output: true false.

Formal Syntax & Structure

javascript syntaxjavascript
stream.locked

Return Value

boolean

Whether the stream is locked.

Working Example

Example Snippetjavascript
const s=new ReadableStream(); const reader=s.getReader(); console.log(s.locked); reader.releaseLock(); console.log(s.locked);
JavaScript Reference