CountQueuingStrategy

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

CountQueuingStrategy interface of the the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.

构造函数

CountQueuingStrategy()
创建新的 CountQueuingStrategy object instance.

特性

None.

方法

CountQueuingStrategy.size()
返回 1 .

范例

const queueingStrategy = new CountQueuingStrategy({ highWaterMark: 1 });
const writableStream = new WritableStream({
  // Implement the sink
  write(chunk) {
    ...
  },
  close() {
    ...
  },
  abort(err) {
    console.log("Sink error:", err);
  }
}, queueingStrategy);
var size = queueingStrategy.size();
					

规范

规范 状态 Comment

The definition of 'CountQueuingStrategy' in that specification.
实时标准 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
CountQueuingStrategy
Chrome 59 Edge 16 Firefox 57
Disabled
57
Disabled
Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true ) and the javascript.options.streams preference (needs to be set to true ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 46 Safari ? WebView Android 59 Chrome Android 59 Firefox Android 57
Disabled
57
Disabled
Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true ) and the javascript.options.streams preference (needs to be set to true ). To change preferences in Firefox, visit about:config.
Opera Android 43 Safari iOS ? Samsung Internet Android 7.0
CountQueuingStrategy() 构造函数
Chrome 59 Edge 16 Firefox 57
Disabled
57
Disabled
Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true ) and the javascript.options.streams preference (needs to be set to true ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 46 Safari ? WebView Android 59 Chrome Android 59 Firefox Android 57
Disabled
57
Disabled
Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true ) and the javascript.options.streams preference (needs to be set to true ). To change preferences in Firefox, visit about:config.
Opera Android 43 Safari iOS ? Samsung Internet Android 7.0
size
Chrome 59 Edge 16 Firefox 57
Disabled
57
Disabled
Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true ) and the javascript.options.streams preference (needs to be set to true ). To change preferences in Firefox, visit about:config.
IE 不支持 No Opera 46 Safari ? WebView Android 59 Chrome Android 59 Firefox Android 57
Disabled
57
Disabled
Disabled From version 57: this feature is behind the dom.streams.enabled preference (needs to be set to true ) and the javascript.options.streams preference (needs to be set to true ). To change preferences in Firefox, visit about:config.
Opera Android 43 Safari iOS ? Samsung Internet Android 7.0

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
用户必须明确启用此特征。
用户必须明确启用此特征。