error()
方法在
ReadableStreamDefaultController
interface causes any future interactions with the associated stream to error.
注意
:
error()
method can be called more than once, and can be called when the stream is not readable.
readableStreamDefaultController.error(e);
The error you want future interactions to fail with.
undefined
.
ReadableStreamDefaultController
, or the stream is not readable for some other reason.
A readable stream with an underlying push source and backpressure support
example in the spec provides a good example of using
ReadablestreamDefaultController.desiredSize
to manually detect when the stream is full and apply backpressure, and also of using
error()
to manually trigger a stream error if another part of the system it relies on fails.
| 规范 | 状态 | 注释 |
|---|---|---|
|
流
The definition of 'error()' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
error
|
Chrome ? | Edge ? |
Firefox
65
|
IE ? | Opera ? | Safari ? | WebView Android ? | Chrome Android ? |
Firefox Android
65
|
Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
完整支持
兼容性未知
实验。期望将来行为有所改变。
用户必须明确启用此特征。
ReadableStreamDefaultController