bump UV, implement arraybufferimpl

This commit is contained in:
CoolElectronics 2023-08-15 13:14:44 -04:00
parent 0e1410bb95
commit b638ab7c98
No known key found for this signature in database
GPG key ID: F63593D168636C50
7 changed files with 35 additions and 21 deletions

View file

@ -106,7 +106,8 @@ export class Connection {
case S2CRequestTypes.WSDataBinary: {
const socketMeta = this.openSockets[requestID];
if (!socketMeta) return;
setTimeout(() => socketMeta.onmessage(data.slice(cursor)));
let slice = data.slice(cursor);
setTimeout(() => socketMeta.onmessage(slice));
break;
}
@ -200,7 +201,8 @@ export class Connection {
onopen: () => void,
onclose: (code: number, reason: string, wasClean: boolean) => void,
onmessage: (data: any) => void,
onerror: (message: string) => void
onerror: (message: string) => void,
arrayBufferImpl: ArrayBufferConstructor,
): {
send: (data: any) => void;
close: (code?: number, reason?: string) => void;
@ -245,11 +247,11 @@ export class Connection {
).catch(cleanup);
return;
}
if (data instanceof window.ArrayBuffer) {
if (data instanceof arrayBufferImpl) {
this.send(seq, C2SRequestTypes.WSSendBinary, data).catch(cleanup);
return;
}
if (window.ArrayBuffer.isView(data)) {
if (arrayBufferImpl.isView(data)) {
this.send(
seq,
C2SRequestTypes.WSSendBinary,