Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: QueueingStrategy
Source: JSObjects/ByteLengthQueuingStrategy.cs
MDN Reference: ByteLengthQueuingStrategy on MDN
https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy
| Signature | Description |
|---|---|
ByteLengthQueuingStrategy(ByteLengthQueuingStrategyOptions options) |
The ByteLengthQueuingStrategy() constructor creates and returns a ByteLengthQueuingStrategy object instance. |
| Property | Type | Access | Description |
|---|---|---|---|
HighWaterMark |
override int |
get | A non-negative integer. This defines the total number of chunks that can be contained in the internal queue before backpressure is applied. |
| Method | Return Type | Description |
|---|---|---|
Size(object chunk) |
int |
The size() method of the ByteLengthQueuingStrategy interface returns the given chunk's byteLength property. |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<ByteLengthQueuingStrategy>(...)or constructornew ByteLengthQueuingStrategy(...)
const queueingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1024 });
const readableStream = new ReadableStream(
{
start(controller) {
// …
},
pull(controller) {
// …
},
cancel(err) {
console.log("stream error:", err);
},
},
queueingStrategy,
);
const size = queueingStrategy.size(chunk);