WritableStreamDefaultController

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

WritableStreamDefaultController()
Creates a new WritableStreamDefaultController object instance.

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 error 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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support58 Yes No ?45 ?
WritableStreamDefaultController() constructor ? ? ? ? ? ?
error ? ? ? ? ? ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support5858 Yes No45 ? ?
WritableStreamDefaultController() constructor ? ? ? ? ? ? ?
error ? ? ? ? ? ? ?

Document Tags and Contributors

Contributors to this page: fscholz, chrisdavidmills, abbycar
Last updated by: fscholz,