ByteLengthQueuingStrategy:highWaterMark 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2019年1月.
只读属性 ByteLengthQueuingStrategy.highWaterMark 返回在应用背压之前,内置队列可以包含的字节总数。
备注:与 CountQueuingStrategy() 不同,后者的 highWaterMark 指定了分块的数量,ByteLengthQueuingStrategy() 的 highWaterMark 参数则指定了字节数量——具体地说,给定一个分块流,在应用背压之前,内部队列可以包含这些分块的字节数(而不是这些分块的数量)。
值
一个整数。
示例
js
const queuingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1 * 1024, }); const readableStream = new ReadableStream( { start(controller) { // … }, pull(controller) { // … }, cancel(err) { console.log("stream error:", err); }, }, queuingStrategy, ); const size = queuingStrategy.size(chunk); console.log(`highWaterMark value: ${queuingStrategy.highWaterMark}$`); 规范
| Specification |
|---|
| Streams> # ref-for-blqs-high-water-mark①> |