CountQueuingStrategy: size() method

Note: This feature is available in Web Workers.

The size() method of the CountQueuingStrategy interface always returns 1, so that the total queue size is a count of the number of chunks in the queue.

Syntax

js
size()

Parameters

None.

Return value

1.

Examples

js
const queuingStrategy = new CountQueuingStrategy({ highWaterMark: 1 });

const writableStream = new WritableStream(
  {
    // Implement the sink
    write(chunk) {
      // …
    },
    close() {
      // …
    },
    abort(err) {
      console.log("Sink error:", err);
    },
  },
  queuingStrategy,
);

const size = queuingStrategy.size();

Specifications

Specification
Streams
# ref-for-cqs-size②

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
size

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also