@colyseus/schema 3.0.0-alpha.8 → 3.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +9 -10
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +9 -10
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +9 -10
- package/lib/encoder/Encoder.js +9 -10
- package/lib/encoder/Encoder.js.map +1 -1
- package/package.json +1 -1
- package/src/encoder/Encoder.ts +9 -10
package/build/cjs/index.js
CHANGED
|
@@ -3459,30 +3459,29 @@ class Encoder {
|
|
|
3459
3459
|
//
|
|
3460
3460
|
this.onEndEncode(changeTrees);
|
|
3461
3461
|
}
|
|
3462
|
-
|
|
3463
|
-
return buffer.slice(0, it.offset);
|
|
3462
|
+
return buffer.subarray(0, it.offset);
|
|
3464
3463
|
}
|
|
3465
3464
|
}
|
|
3466
3465
|
encodeAll(it = { offset: 0 }, buffer = this.sharedBuffer) {
|
|
3467
|
-
// console.log(`encodeAll(), this
|
|
3468
|
-
// Array.from(this
|
|
3466
|
+
// console.log(`encodeAll(), this.root.allChanges (${this.root.allChanges.size})`);
|
|
3467
|
+
// Array.from(this.root.allChanges.entries()).map((item) => {
|
|
3469
3468
|
// console.log("->", item[0].refId, item[0].ref.toJSON());
|
|
3470
3469
|
// });
|
|
3471
3470
|
return this.encode(it, undefined, buffer, this.root.allChanges);
|
|
3472
3471
|
}
|
|
3473
3472
|
encodeAllView(view, sharedOffset, it, bytes = this.sharedBuffer) {
|
|
3474
3473
|
const viewOffset = it.offset;
|
|
3475
|
-
// console.log(`encodeAllView(), this
|
|
3474
|
+
// console.log(`encodeAllView(), this.root.allFilteredChanges (${this.root.allFilteredChanges.size})`);
|
|
3476
3475
|
// this.debugAllFilteredChanges();
|
|
3477
3476
|
// try to encode "filtered" changes
|
|
3478
3477
|
this.encode(it, view, bytes, this.root.allFilteredChanges);
|
|
3479
3478
|
return Buffer.concat([
|
|
3480
|
-
bytes.
|
|
3481
|
-
bytes.
|
|
3479
|
+
bytes.subarray(0, sharedOffset),
|
|
3480
|
+
bytes.subarray(viewOffset, it.offset)
|
|
3482
3481
|
]);
|
|
3483
3482
|
}
|
|
3484
3483
|
// debugAllFilteredChanges() {
|
|
3485
|
-
// Array.from(this
|
|
3484
|
+
// Array.from(this.root.allFilteredChanges.entries()).map((item) => {
|
|
3486
3485
|
// console.log("->", { refId: item[0].refId }, item[0].ref.toJSON());
|
|
3487
3486
|
// if (Array.isArray(item[0].ref.toJSON())) {
|
|
3488
3487
|
// item[1].forEach((op, key) => {
|
|
@@ -3522,8 +3521,8 @@ class Encoder {
|
|
|
3522
3521
|
// clear "view" changes after encoding
|
|
3523
3522
|
view.changes.clear();
|
|
3524
3523
|
return Buffer.concat([
|
|
3525
|
-
bytes.
|
|
3526
|
-
bytes.
|
|
3524
|
+
bytes.subarray(0, sharedOffset),
|
|
3525
|
+
bytes.subarray(viewOffset, it.offset)
|
|
3527
3526
|
]);
|
|
3528
3527
|
}
|
|
3529
3528
|
onEndEncode(changeTrees = this.root.changes) {
|