refactor for multiple sessions

This commit is contained in:
DavidVentura
2024-01-31 16:11:22 +01:00
parent 2924eaab79
commit c12c432e71
7 changed files with 167 additions and 80 deletions
+5
View File
@@ -55,11 +55,16 @@ DataView.prototype.readString = function (len) {
if (nullByte !== -1) return s.substring(0, nullByte);
return s;
};
DataView.prototype.writeString = function (str) {
const bytes = [...str].map((_, i) => str.charCodeAt(i));
return this.writeByteArray(bytes);
};
declare global {
interface DataView {
add(offset: number): DataView;
readByteArray(len: number): DataView;
writeString(str: string): void;
readString(len: number): string;
readU16(): number;
readU16LE(): number;