CountQueuingStrategy:size() 方法
注意:此功能在 Web Workers 中可用。
CountQueuingStrategy 介面的 size() 方法始終返回 1,因此佇列的總大小等於佇列中塊的數量。
語法
js
size()
引數
無。
返回值
1.
示例
js
const queuingStrategy = new CountQueuingStrategy({ highWaterMark: 1 });
const writableStream = new WritableStream(
{
// Implement the sink
write(chunk) {
// …
},
close() {
// …
},
abort(err) {
console.log("Sink error:", err);
},
},
queuingStrategy,
);
const size = queuingStrategy.size();
規範
| 規範 |
|---|
| Streams # ref-for-cqs-size② |
瀏覽器相容性
載入中…