Compare commits

...

3 Commits

3 changed files with 28 additions and 5 deletions

12
dist/index.js vendored
View File

@ -134,8 +134,16 @@ class Message extends Client {
onmessage: !!this.onmessage, onmessage: !!this.onmessage,
}, },
}, async (data) => { }, async (data) => {
if (data?.args && data?.args[0] instanceof Uint8Array) { if (data.args) {
data.args[0] = b4a.from(data.args[0]); data.args = data.args.filter((arg) => {
if (arg instanceof Uint8Array) {
return b4a.from(arg);
}
return arg;
});
}
if (data?.args && data?.args[0]?.buffer instanceof Uint8Array) {
data.args[0].buffer = b4a.from(data.args[0].buffer);
} }
switch (data.action) { switch (data.action) {
case "encode": case "encode":

View File

@ -12,5 +12,10 @@
"@types/b4a": "^1.6.0", "@types/b4a": "^1.6.0",
"prettier": "^2.8.7", "prettier": "^2.8.7",
"typescript": "^5.0.4" "typescript": "^5.0.4"
},
"pnpm": {
"patchedDependencies": {
"b4a@1.6.3": "patches/b4a@1.6.3.patch"
}
} }
} }

View File

@ -216,8 +216,18 @@ class Message extends Client {
}, },
}, },
async (data: any) => { async (data: any) => {
if (data?.args && data?.args[0] instanceof Uint8Array) { if (data.args) {
data.args[0] = b4a.from(data.args[0]); data.args = data.args.filter((arg: any) => {
if (arg instanceof Uint8Array) {
return b4a.from(arg);
}
return arg;
});
}
if (data?.args && data?.args[0]?.buffer instanceof Uint8Array) {
data.args[0].buffer = b4a.from(data.args[0].buffer);
} }
switch (data.action) { switch (data.action) {
case "encode": case "encode":