@colyseus/schema 3.0.73 → 3.0.74
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 +7 -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 +7 -1
- package/lib/annotations.js +7 -1
- package/lib/annotations.js.map +1 -1
- package/package.json +1 -1
- package/src/annotations.ts +7 -1
package/build/esm/index.mjs
CHANGED
|
@@ -3587,7 +3587,13 @@ function schema(fieldsAndMethods, name, inherits = Schema) {
|
|
|
3587
3587
|
// call initialize method
|
|
3588
3588
|
if (methods.initialize && typeof methods.initialize === 'function') {
|
|
3589
3589
|
super(Object.assign({}, getDefaultValues(), getParentProps(args[0] || {})));
|
|
3590
|
-
|
|
3590
|
+
/**
|
|
3591
|
+
* only call initialize() in the current class, not the parent ones.
|
|
3592
|
+
* see "should not call initialize automatically when creating an instance of inherited Schema"
|
|
3593
|
+
*/
|
|
3594
|
+
if (new.target === klass) {
|
|
3595
|
+
methods.initialize.apply(this, args);
|
|
3596
|
+
}
|
|
3591
3597
|
}
|
|
3592
3598
|
else {
|
|
3593
3599
|
super(Object.assign({}, getDefaultValues(), args[0] || {}));
|