@dcl/ecs 7.5.7-10289449044.commit-c15b62f → 7.5.7-10312762318.commit-2f6b9a0
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/dist/engine/grow-only-value-set-component-definition.js +10 -3
- package/dist/engine/index.js +2 -8
- package/dist/engine/lww-element-set-component-definition.js +10 -3
- package/dist-cjs/engine/grow-only-value-set-component-definition.js +10 -3
- package/dist-cjs/engine/index.js +2 -8
- package/dist-cjs/engine/lww-element-set-component-definition.js +10 -3
- package/package.json +2 -2
|
@@ -141,10 +141,17 @@ export function createValueSetComponentDefinitionFromSchema(componentName, compo
|
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
143
|
onChange(entity, cb) {
|
|
144
|
-
onChangeCallbacks.
|
|
144
|
+
const cbs = onChangeCallbacks.get(entity) ?? [];
|
|
145
|
+
cbs.push(cb);
|
|
146
|
+
onChangeCallbacks.set(entity, cbs);
|
|
145
147
|
},
|
|
146
|
-
__onChangeCallbacks(entity) {
|
|
147
|
-
|
|
148
|
+
__onChangeCallbacks(entity, value) {
|
|
149
|
+
const cbs = onChangeCallbacks.get(entity);
|
|
150
|
+
if (!cbs)
|
|
151
|
+
return;
|
|
152
|
+
for (const cb of cbs) {
|
|
153
|
+
cb(value);
|
|
154
|
+
}
|
|
148
155
|
}
|
|
149
156
|
};
|
|
150
157
|
return ret;
|
package/dist/engine/index.js
CHANGED
|
@@ -203,17 +203,11 @@ export function Engine(options) {
|
|
|
203
203
|
const onChangeFunction = (entity, operation, component, componentValue) => {
|
|
204
204
|
if (operation === CrdtMessageType.DELETE_ENTITY) {
|
|
205
205
|
for (const component of partialEngine.componentsIter()) {
|
|
206
|
-
|
|
207
|
-
if (onChange) {
|
|
208
|
-
onChange(undefined);
|
|
209
|
-
}
|
|
206
|
+
component?.__onChangeCallbacks(entity, undefined);
|
|
210
207
|
}
|
|
211
208
|
}
|
|
212
209
|
else {
|
|
213
|
-
|
|
214
|
-
if (onChange) {
|
|
215
|
-
onChange(componentValue);
|
|
216
|
-
}
|
|
210
|
+
component?.__onChangeCallbacks(entity, componentValue);
|
|
217
211
|
}
|
|
218
212
|
return options?.onChangeFunction(entity, operation, component, componentValue);
|
|
219
213
|
};
|
|
@@ -264,10 +264,17 @@ export function createComponentDefinitionFromSchema(componentName, componentId,
|
|
|
264
264
|
updateFromCrdt: createUpdateLwwFromCrdt(componentId, timestamps, schema, data),
|
|
265
265
|
dumpCrdtStateToBuffer: createDumpLwwFunctionFromCrdt(componentId, timestamps, schema, data),
|
|
266
266
|
onChange(entity, cb) {
|
|
267
|
-
onChangeCallbacks.
|
|
267
|
+
const cbs = onChangeCallbacks.get(entity) ?? [];
|
|
268
|
+
cbs.push(cb);
|
|
269
|
+
onChangeCallbacks.set(entity, cbs);
|
|
268
270
|
},
|
|
269
|
-
__onChangeCallbacks(entity) {
|
|
270
|
-
|
|
271
|
+
__onChangeCallbacks(entity, value) {
|
|
272
|
+
const cbs = onChangeCallbacks.get(entity);
|
|
273
|
+
if (!cbs)
|
|
274
|
+
return;
|
|
275
|
+
for (const cb of cbs) {
|
|
276
|
+
cb(value);
|
|
277
|
+
}
|
|
271
278
|
}
|
|
272
279
|
};
|
|
273
280
|
}
|
|
@@ -144,10 +144,17 @@ function createValueSetComponentDefinitionFromSchema(componentName, componentId,
|
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
onChange(entity, cb) {
|
|
147
|
-
onChangeCallbacks.
|
|
147
|
+
const cbs = onChangeCallbacks.get(entity) ?? [];
|
|
148
|
+
cbs.push(cb);
|
|
149
|
+
onChangeCallbacks.set(entity, cbs);
|
|
148
150
|
},
|
|
149
|
-
__onChangeCallbacks(entity) {
|
|
150
|
-
|
|
151
|
+
__onChangeCallbacks(entity, value) {
|
|
152
|
+
const cbs = onChangeCallbacks.get(entity);
|
|
153
|
+
if (!cbs)
|
|
154
|
+
return;
|
|
155
|
+
for (const cb of cbs) {
|
|
156
|
+
cb(value);
|
|
157
|
+
}
|
|
151
158
|
}
|
|
152
159
|
};
|
|
153
160
|
return ret;
|
package/dist-cjs/engine/index.js
CHANGED
|
@@ -232,17 +232,11 @@ function Engine(options) {
|
|
|
232
232
|
const onChangeFunction = (entity, operation, component, componentValue) => {
|
|
233
233
|
if (operation === crdt_2.CrdtMessageType.DELETE_ENTITY) {
|
|
234
234
|
for (const component of partialEngine.componentsIter()) {
|
|
235
|
-
|
|
236
|
-
if (onChange) {
|
|
237
|
-
onChange(undefined);
|
|
238
|
-
}
|
|
235
|
+
component?.__onChangeCallbacks(entity, undefined);
|
|
239
236
|
}
|
|
240
237
|
}
|
|
241
238
|
else {
|
|
242
|
-
|
|
243
|
-
if (onChange) {
|
|
244
|
-
onChange(componentValue);
|
|
245
|
-
}
|
|
239
|
+
component?.__onChangeCallbacks(entity, componentValue);
|
|
246
240
|
}
|
|
247
241
|
return options?.onChangeFunction(entity, operation, component, componentValue);
|
|
248
242
|
};
|
|
@@ -271,10 +271,17 @@ function createComponentDefinitionFromSchema(componentName, componentId, schema)
|
|
|
271
271
|
updateFromCrdt: createUpdateLwwFromCrdt(componentId, timestamps, schema, data),
|
|
272
272
|
dumpCrdtStateToBuffer: createDumpLwwFunctionFromCrdt(componentId, timestamps, schema, data),
|
|
273
273
|
onChange(entity, cb) {
|
|
274
|
-
onChangeCallbacks.
|
|
274
|
+
const cbs = onChangeCallbacks.get(entity) ?? [];
|
|
275
|
+
cbs.push(cb);
|
|
276
|
+
onChangeCallbacks.set(entity, cbs);
|
|
275
277
|
},
|
|
276
|
-
__onChangeCallbacks(entity) {
|
|
277
|
-
|
|
278
|
+
__onChangeCallbacks(entity, value) {
|
|
279
|
+
const cbs = onChangeCallbacks.get(entity);
|
|
280
|
+
if (!cbs)
|
|
281
|
+
return;
|
|
282
|
+
for (const cb of cbs) {
|
|
283
|
+
cb(value);
|
|
284
|
+
}
|
|
278
285
|
}
|
|
279
286
|
};
|
|
280
287
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
3
|
"description": "Decentraland ECS",
|
|
4
|
-
"version": "7.5.7-
|
|
4
|
+
"version": "7.5.7-10312762318.commit-2f6b9a0",
|
|
5
5
|
"author": "DCL",
|
|
6
6
|
"bugs": "https://github.com/decentraland/ecs/issues",
|
|
7
7
|
"files": [
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
},
|
|
34
34
|
"types": "./dist/index.d.ts",
|
|
35
35
|
"typings": "./dist/index.d.ts",
|
|
36
|
-
"commit": "
|
|
36
|
+
"commit": "2f6b9a042ab7db93be07ea4cfdb9fb86be1d0cb3"
|
|
37
37
|
}
|