CountQueuingStrategy
Streams API 的 CountQueuingStrategy
接口提供了一个内置的、用于对分块进行计数的队列策略,可以在构造流的时候使用。
构造函数
CountQueuingStrategy()
-
创建一个新的
CountQueuingStrategy
对象实例。
实例属性
CountQueuingStrategy.highWaterMark
只读-
在应用背压之前,内部队列可以包含的分块总数。
实例方法
示例
js
const queueingStrategy = new CountQueuingStrategy({ highWaterMark: 1 });
const writableStream = new WritableStream(
{
// Implement the sink
write(chunk) {
// …
},
close() {
// …
},
abort(err) {
console.log("Sink error:", err);
},
},
queueingStrategy,
);
const size = queueingStrategy.size();
规范
Specification |
---|
Streams # cqs-class |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CountQueuingStrategy | ||||||||||||||
CountQueuingStrategy() constructor | ||||||||||||||
highWaterMark | ||||||||||||||
size |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.