Note: This feature is available in Web Workers.
The CountQueuingStrategy() constructor creates and returns a CountQueuingStrategy object instance.
new CountQueuingStrategy(options)optionsAn object with the following property:
highWaterMarkThe total number of chunks that can be contained in the internal queue before backpressure is applied.
An instance of the CountQueuingStrategy object.
None.
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();