refactor: state diff
This commit is contained in:
parent
8d0dd86488
commit
88d1634b8f
|
@ -28,7 +28,11 @@ export class WorldTime {
|
|||
}
|
||||
|
||||
patchState(patch) {
|
||||
this.hour = patch;
|
||||
for (const {path, value} of patch) {
|
||||
if ('/' === path) {
|
||||
this.hour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
secondsPerHour() {
|
||||
|
|
|
@ -110,7 +110,6 @@ export class Informed extends decorate(Trait) {
|
|||
// Take diff.
|
||||
let diff = stateSynchronizer.diff(this._informState);
|
||||
this._informState = stateSynchronizer.state;
|
||||
diff = this.reduceStateDiff(diff);
|
||||
// Emit!
|
||||
if (diff) {
|
||||
this._socket.send({type: 'state-update', payload: diff});
|
||||
|
|
Loading…
Reference in New Issue
Block a user