chore: various op cleanup (#12329)

This commit is contained in:
Leo K 2021-10-05 22:38:27 +02:00 committed by GitHub
parent d67e858506
commit 77a00ce1fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 131 additions and 185 deletions

View file

@ -190,15 +190,14 @@
const writable = new WritableStream({
write: async (chunk) => {
if (typeof chunk === "string") {
await core.opAsync("op_ws_send", {
rid: this[_rid],
await core.opAsync("op_ws_send", this[_rid], {
kind: "text",
text: chunk,
value: chunk,
});
} else if (chunk instanceof Uint8Array) {
await core.opAsync("op_ws_send", {
rid: this[_rid],
await core.opAsync("op_ws_send", this[_rid], {
kind: "binary",
value: chunk,
}, chunk);
} else {
throw new TypeError(
@ -257,8 +256,7 @@
break;
}
case "ping": {
await core.opAsync("op_ws_send", {
rid: this[_rid],
await core.opAsync("op_ws_send", this[_rid], {
kind: "pong",
});
break;