Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. WritableStreamDefaultController

WritableStreamDefaultController

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨May 2022⁩.

Note: This feature is available inWeb Workers.

TheWritableStreamDefaultController interface of theStreams API represents a controller allowing control of aWritableStream's state. When constructing aWritableStream, the underlying sink is given a correspondingWritableStreamDefaultController instance to manipulate.

Constructor

None.WritableStreamDefaultController instances are created automatically duringWritableStream construction.

Instance properties

WritableStreamDefaultController.signalRead only

Returns theAbortSignal associated with the controller.

Instance methods

WritableStreamDefaultController.error()

Causes any future interactions with the associated stream to error.

Examples

js
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
Streams
# ws-default-controller-class

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp