* @param {UnderlyingSink} [sink] * @param {QueuingStrategy} [strategy]
(sink = kEmptyObject, strategy = kEmptyObject)
| 182 | * @param {QueuingStrategy} [strategy] |
| 183 | */ |
| 184 | constructor(sink = kEmptyObject, strategy = kEmptyObject) { |
| 185 | markTransferMode(this, false, true); |
| 186 | validateObject(sink, 'sink', kValidateObjectAllowObjects); |
| 187 | validateObject(strategy, 'strategy', kValidateObjectAllowObjectsAndNull); |
| 188 | const type = sink?.type; |
| 189 | if (type !== undefined) |
| 190 | throw new ERR_INVALID_ARG_VALUE.RangeError('type', type); |
| 191 | |
| 192 | this[kState] = createWritableStreamState(); |
| 193 | |
| 194 | const size = extractSizeAlgorithm(strategy?.size); |
| 195 | const highWaterMark = extractHighWaterMark(strategy?.highWaterMark, 1); |
| 196 | |
| 197 | setupWritableStreamDefaultControllerFromSink( |
| 198 | this, |
| 199 | sink, |
| 200 | highWaterMark, |
| 201 | size); |
| 202 | } |
| 203 | |
| 204 | get [kIsErrored]() { |
| 205 | return this[kState].state === 'errored'; |
nothing calls this directly
no test coverage detected