mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-14 14:50:03 -04:00
properly handle subarray messages
This commit is contained in:
parent
f90d159fac
commit
172c5a3ee6
1 changed files with 2 additions and 2 deletions
|
@ -338,8 +338,8 @@ export class BareClient {
|
||||||
|
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
let data = args[0];
|
let data = args[0];
|
||||||
// @ts-expect-error idk why it errors?
|
// @ts-expect-error
|
||||||
if (data.buffer) data = data.buffer;
|
if (data.buffer) data = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
||||||
|
|
||||||
channel.port1.postMessage({ type: "data", data: data }, data instanceof ArrayBuffer ? [data] : []);
|
channel.port1.postMessage({ type: "data", data: data }, data instanceof ArrayBuffer ? [data] : []);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue