ByteLengthQueuingStrategy

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

ByteLengthQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.

构造函数

ByteLengthQueuingStrategy()
创建新的 ByteLengthQueuingStrategy object instance.

特性

None.

方法

ByteLengthQueuingStrategy.size()
Returns the given chunk’s byteLength 特性。

范例

const queueingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1 });
const readableStream = new ReadableStream({
  start(controller) {
    ...
  },
  pull(controller) {
    ...
  },
  cancel(err) {
    console.log("stream error:", err);
  }
}, queueingStrategy);
var size = queueingStrategy.size(chunk);
					

规范

规范 状态 Comment

The definition of 'ByteLengthQueuingStrategy' 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
ByteLengthQueuingStrategy
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
ByteLengthQueuingStrategy() 构造函数
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

图例

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