@colyseus/schema 3.0.32 → 3.0.34
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 +10 -3
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +10 -3
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +10 -3
- package/lib/decoder/strategy/StateCallbacks.js +2 -1
- package/lib/decoder/strategy/StateCallbacks.js.map +1 -1
- package/lib/encoder/ChangeTree.js +8 -2
- package/lib/encoder/ChangeTree.js.map +1 -1
- package/package.json +3 -3
- package/src/decoder/strategy/StateCallbacks.ts +4 -1
- package/src/encoder/ChangeTree.ts +7 -2
package/build/cjs/index.js
CHANGED
|
@@ -1103,8 +1103,14 @@ class ChangeTree {
|
|
|
1103
1103
|
operation(op) {
|
|
1104
1104
|
// operations without index use negative values to represent them
|
|
1105
1105
|
// this is checked during .encode() time.
|
|
1106
|
-
this.
|
|
1107
|
-
|
|
1106
|
+
if (this.filteredChanges !== undefined) {
|
|
1107
|
+
this.filteredChanges.operations.push(-op);
|
|
1108
|
+
enqueueChangeTree(this.root, this, 'filteredChanges');
|
|
1109
|
+
}
|
|
1110
|
+
else {
|
|
1111
|
+
this.changes.operations.push(-op);
|
|
1112
|
+
enqueueChangeTree(this.root, this, 'changes');
|
|
1113
|
+
}
|
|
1108
1114
|
}
|
|
1109
1115
|
change(index, operation = exports.OPERATION.ADD) {
|
|
1110
1116
|
const metadata = this.ref.constructor[Symbol.metadata];
|
|
@@ -4604,7 +4610,8 @@ function getDecoderStateCallbacks(decoder) {
|
|
|
4604
4610
|
}
|
|
4605
4611
|
}
|
|
4606
4612
|
}
|
|
4607
|
-
else if ((change.op & exports.OPERATION.ADD) === exports.OPERATION.ADD &&
|
|
4613
|
+
else if ((change.op & exports.OPERATION.ADD) === exports.OPERATION.ADD &&
|
|
4614
|
+
change.previousValue !== change.value) {
|
|
4608
4615
|
// triger onAdd
|
|
4609
4616
|
const addCallbacks = $callbacks[exports.OPERATION.ADD];
|
|
4610
4617
|
for (let i = addCallbacks?.length - 1; i >= 0; i--) {
|