-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
49 lines (36 loc) · 904 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: "WritableStream: locked property"
short-title: locked
slug: Web/API/WritableStream/locked
page-type: web-api-instance-property
browser-compat: api.WritableStream.locked
---
{{APIRef("Streams")}}{{AvailableInWorkers}}
The **`locked`** read-only property of the {{domxref("WritableStream")}} interface returns a boolean indicating whether the `WritableStream` is locked to a writer.
## Value
A boolean value indicating whether or not the writable stream is locked.
## Examples
```js
const writableStream = new WritableStream(
{
write(chunk) {
// ...
},
close() {
// ...
},
abort(err) {
// ...
},
},
queuingStrategy,
);
// ...
const writer = writableStream.getWriter();
writableStream.locked;
// should return true, as the stream has been locked to a writer
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}