@colyseus/schema 2.0.13 → 2.0.15
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 +15 -1
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +7 -1
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +15 -1
- package/lib/Schema.d.ts +1 -1
- package/lib/Schema.js +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/types/ArraySchema.d.ts +1 -0
- package/lib/types/ArraySchema.js +3 -0
- package/lib/types/ArraySchema.js.map +1 -1
- package/lib/types/MapSchema.d.ts +1 -0
- package/lib/types/MapSchema.js +3 -0
- package/lib/types/MapSchema.js.map +1 -1
- package/package.json +1 -1
- package/src/Schema.ts +2 -2
- package/src/types/ArraySchema.ts +4 -0
- package/src/types/MapSchema.ts +4 -0
package/build/esm/index.mjs
CHANGED
|
@@ -695,6 +695,9 @@ class ArraySchema {
|
|
|
695
695
|
[Symbol.iterator]() {
|
|
696
696
|
return Array.from(this.$items.values())[Symbol.iterator]();
|
|
697
697
|
}
|
|
698
|
+
static get [Symbol.species]() {
|
|
699
|
+
return ArraySchema;
|
|
700
|
+
}
|
|
698
701
|
// WORKAROUND for compatibility
|
|
699
702
|
// - TypeScript 4 defines @@unscopables as a function
|
|
700
703
|
// - TypeScript 5 defines @@unscopables as an object
|
|
@@ -866,6 +869,9 @@ class MapSchema {
|
|
|
866
869
|
/** Iterator */
|
|
867
870
|
[Symbol.iterator]() { return this.$items[Symbol.iterator](); }
|
|
868
871
|
get [Symbol.toStringTag]() { return this.$items[Symbol.toStringTag]; }
|
|
872
|
+
static get [Symbol.species]() {
|
|
873
|
+
return MapSchema;
|
|
874
|
+
}
|
|
869
875
|
set(key, value) {
|
|
870
876
|
if (value === undefined || value === null) {
|
|
871
877
|
throw new Error(`MapSchema#set('${key}', ${value}): trying to set ${value} value on '${key}'.`);
|
|
@@ -2939,7 +2945,7 @@ class Schema {
|
|
|
2939
2945
|
if (!uniqueRefIds.has(refId)) {
|
|
2940
2946
|
try {
|
|
2941
2947
|
// trigger onChange
|
|
2942
|
-
$callbacks?.[OPERATION.REPLACE]?.forEach(callback => callback(
|
|
2948
|
+
$callbacks?.[OPERATION.REPLACE]?.forEach(callback => callback());
|
|
2943
2949
|
}
|
|
2944
2950
|
catch (e) {
|
|
2945
2951
|
Schema.onError(e);
|