@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.
@@ -3455,30 +3455,29 @@ class Encoder {
3455
3455
  //
3456
3456
  this.onEndEncode(changeTrees);
3457
3457
  }
3458
- // return bytes;
3459
- return buffer.slice(0, it.offset);
3458
+ return buffer.subarray(0, it.offset);
3460
3459
  }
3461
3460
  }
3462
3461
  encodeAll(it = { offset: 0 }, buffer = this.sharedBuffer) {
3463
- // console.log(`encodeAll(), this.$root.allChanges (${this.$root.allChanges.size})`);
3464
- // Array.from(this.$root.allChanges.entries()).map((item) => {
3462
+ // console.log(`encodeAll(), this.root.allChanges (${this.root.allChanges.size})`);
3463
+ // Array.from(this.root.allChanges.entries()).map((item) => {
3465
3464
  // console.log("->", item[0].refId, item[0].ref.toJSON());
3466
3465
  // });
3467
3466
  return this.encode(it, undefined, buffer, this.root.allChanges);
3468
3467
  }
3469
3468
  encodeAllView(view, sharedOffset, it, bytes = this.sharedBuffer) {
3470
3469
  const viewOffset = it.offset;
3471
- // console.log(`encodeAllView(), this.$root.allFilteredChanges (${this.$root.allFilteredChanges.size})`);
3470
+ // console.log(`encodeAllView(), this.root.allFilteredChanges (${this.root.allFilteredChanges.size})`);
3472
3471
  // this.debugAllFilteredChanges();
3473
3472
  // try to encode "filtered" changes
3474
3473
  this.encode(it, view, bytes, this.root.allFilteredChanges);
3475
3474
  return Buffer.concat([
3476
- bytes.slice(0, sharedOffset),
3477
- bytes.slice(viewOffset, it.offset)
3475
+ bytes.subarray(0, sharedOffset),
3476
+ bytes.subarray(viewOffset, it.offset)
3478
3477
  ]);
3479
3478
  }
3480
3479
  // debugAllFilteredChanges() {
3481
- // Array.from(this.$root.allFilteredChanges.entries()).map((item) => {
3480
+ // Array.from(this.root.allFilteredChanges.entries()).map((item) => {
3482
3481
  // console.log("->", { refId: item[0].refId }, item[0].ref.toJSON());
3483
3482
  // if (Array.isArray(item[0].ref.toJSON())) {
3484
3483
  // item[1].forEach((op, key) => {
@@ -3518,8 +3517,8 @@ class Encoder {
3518
3517
  // clear "view" changes after encoding
3519
3518
  view.changes.clear();
3520
3519
  return Buffer.concat([
3521
- bytes.slice(0, sharedOffset),
3522
- bytes.slice(viewOffset, it.offset)
3520
+ bytes.subarray(0, sharedOffset),
3521
+ bytes.subarray(viewOffset, it.offset)
3523
3522
  ]);
3524
3523
  }
3525
3524
  onEndEncode(changeTrees = this.root.changes) {