Function
push
(data: Uint8Array | string)
Source from the content-addressed store, hash-verified
| 1036 | } |
| 1037 | |
| 1038 | function push(data: Uint8Array | string) { |
| 1039 | if (overflowed) return |
| 1040 | buffer.push(data) |
| 1041 | if (highWaterMark !== undefined) { |
| 1042 | bufferSize += (typeof data === "string" ? encoder.encode(data).byteLength : data.byteLength) || 1 |
| 1043 | } |
| 1044 | if (waiter !== undefined) deliver() |
| 1045 | if (pausable && bufferSize >= highWaterMark!) { |
| 1046 | pauseWebSocket() |
| 1047 | } else if (!pausable && bufferSize > highWaterMark!) { |
| 1048 | overflow() |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | function overflow() { |
| 1053 | overflowed = true |
Tested by
no test coverage detected