@colyseus/schema 2.0.17 → 2.0.18
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 +8 -8
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +8 -8
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +8 -8
- package/lib/Schema.js +2 -2
- package/lib/Schema.js.map +1 -1
- package/lib/types/ArraySchema.js +3 -3
- package/lib/types/ArraySchema.js.map +1 -1
- package/lib/types/MapSchema.js +3 -3
- package/lib/types/MapSchema.js.map +1 -1
- package/package.json +1 -1
- package/src/Schema.ts +2 -2
- package/src/types/ArraySchema.ts +3 -3
- package/src/types/MapSchema.ts +3 -3
- package/lib/events/EventEmitter.d.ts +0 -13
- package/lib/events/EventEmitter.js +0 -31
- package/lib/events/EventEmitter.js.map +0 -1
- package/lib/types/index.d.ts +0 -6
- package/lib/types/index.js +0 -13
- package/lib/types/index.js.map +0 -1
package/build/cjs/index.js
CHANGED
|
@@ -412,12 +412,12 @@ var ArraySchema = /** @class */ (function () {
|
|
|
412
412
|
}
|
|
413
413
|
ArraySchema.prototype.onAdd = function (callback, triggerAll) {
|
|
414
414
|
if (triggerAll === void 0) { triggerAll = true; }
|
|
415
|
-
return addCallback((this.$callbacks || (this.$callbacks =
|
|
415
|
+
return addCallback((this.$callbacks || (this.$callbacks = {})), exports.OPERATION.ADD, callback, (triggerAll)
|
|
416
416
|
? this.$items
|
|
417
417
|
: undefined);
|
|
418
418
|
};
|
|
419
|
-
ArraySchema.prototype.onRemove = function (callback) { return addCallback(this.$callbacks || (this.$callbacks =
|
|
420
|
-
ArraySchema.prototype.onChange = function (callback) { return addCallback(this.$callbacks || (this.$callbacks =
|
|
419
|
+
ArraySchema.prototype.onRemove = function (callback) { return addCallback(this.$callbacks || (this.$callbacks = {}), exports.OPERATION.DELETE, callback); };
|
|
420
|
+
ArraySchema.prototype.onChange = function (callback) { return addCallback(this.$callbacks || (this.$callbacks = {}), exports.OPERATION.REPLACE, callback); };
|
|
421
421
|
ArraySchema.is = function (type) {
|
|
422
422
|
return (
|
|
423
423
|
// type format: ["string"]
|
|
@@ -939,12 +939,12 @@ var MapSchema = /** @class */ (function () {
|
|
|
939
939
|
}
|
|
940
940
|
MapSchema.prototype.onAdd = function (callback, triggerAll) {
|
|
941
941
|
if (triggerAll === void 0) { triggerAll = true; }
|
|
942
|
-
return addCallback((this.$callbacks || (this.$callbacks =
|
|
942
|
+
return addCallback((this.$callbacks || (this.$callbacks = {})), exports.OPERATION.ADD, callback, (triggerAll)
|
|
943
943
|
? this.$items
|
|
944
944
|
: undefined);
|
|
945
945
|
};
|
|
946
|
-
MapSchema.prototype.onRemove = function (callback) { return addCallback(this.$callbacks || (this.$callbacks =
|
|
947
|
-
MapSchema.prototype.onChange = function (callback) { return addCallback(this.$callbacks || (this.$callbacks =
|
|
946
|
+
MapSchema.prototype.onRemove = function (callback) { return addCallback(this.$callbacks || (this.$callbacks = {}), exports.OPERATION.DELETE, callback); };
|
|
947
|
+
MapSchema.prototype.onChange = function (callback) { return addCallback(this.$callbacks || (this.$callbacks = {}), exports.OPERATION.REPLACE, callback); };
|
|
948
948
|
MapSchema.is = function (type) {
|
|
949
949
|
return type['map'] !== undefined;
|
|
950
950
|
};
|
|
@@ -2434,10 +2434,10 @@ var Schema = /** @class */ (function () {
|
|
|
2434
2434
|
type['_definition'].schema !== undefined);
|
|
2435
2435
|
};
|
|
2436
2436
|
Schema.prototype.onChange = function (callback) {
|
|
2437
|
-
return addCallback((this.$callbacks || (this.$callbacks =
|
|
2437
|
+
return addCallback((this.$callbacks || (this.$callbacks = {})), exports.OPERATION.REPLACE, callback);
|
|
2438
2438
|
};
|
|
2439
2439
|
Schema.prototype.onRemove = function (callback) {
|
|
2440
|
-
return addCallback((this.$callbacks || (this.$callbacks =
|
|
2440
|
+
return addCallback((this.$callbacks || (this.$callbacks = {})), exports.OPERATION.DELETE, callback);
|
|
2441
2441
|
};
|
|
2442
2442
|
Schema.prototype.assign = function (props) {
|
|
2443
2443
|
Object.assign(this, props);
|