This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The WritableStreamDefaultController interface of the the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
Constructor
- None.
WritableStreamDefaultControllerinstances are created automatically duringWritableStreamconstruction.
Properties
- None.
Methods
WritableStreamDefaultController.error()- Causes any future interactions with the associated stream to error.
Examples
const writableStream = new WritableStream({
start(controller) {
// do stuff with controller
// error stream if necessary
controller.error('My stream is broken');
},
write(chunk, controller) {
...
},
close(controller) {
...
},
abort(err) {
...
}
});
Specifications
| Specification | Status | Comment |
|---|---|---|
| Streams The definition of 'WritableStreamDefaultController' in that specification. |
Living Standard | Initial definition. |
Browser compatibility
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.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
WritableStreamDefaultController | Chrome Full support 58 | Edge Full support ≤18 | Firefox No support No | IE ? | Opera Full support 45 | Safari ? | WebView Android Full support 58 | Chrome Android Full support 58 | Firefox Android No support No | Opera Android Full support 43 | Safari iOS ? | Samsung Internet Android Full support 7.0 |
error | Chrome ? | Edge Full support 16 | Firefox No support No | IE ? | Opera ? | Safari ? | WebView Android ? | Chrome Android ? | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
