WritableStream: locked プロパティ

lockedWritableStream インターフェイスの読み取り専用プロパティは、 WritableStream がライターにロックされているかどうかを示す論理値を返します。

論理値で、書き込み可能なストリームがロックされているかどうかを示します。

js
const writableStream = new WritableStream(
  {
    write(chunk) {
      // ...
    },
    close() {
      // ...
    },
    abort(err) {
      // ...
    },
  },
  queuingStrategy,
);

// ...

const writer = writableStream.getWriter();

writableStream.locked;
// ストリームがライターにロックされているため、true を返します

仕様書

Specification
Streams
# ref-for-ws-locked②

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
locked

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support