From dd0f4da9addd87fd7f4126d5bb31563c53edfc2d Mon Sep 17 00:00:00 2001 From: cha0s Date: Tue, 1 Oct 2019 22:42:26 -0500 Subject: [PATCH] refactor: send initial entity state --- packages/entity/list/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/entity/list/index.js b/packages/entity/list/index.js index 8d894a9..d9eb5a1 100644 --- a/packages/entity/list/index.js +++ b/packages/entity/list/index.js @@ -204,6 +204,16 @@ export class EntityList extends decorate(class {}) { } } + toNetwork(informed) { + const {areaToInform} = informed; + const visibleEntities = this.visibleEntities(areaToInform); + // Mark as notified. + this._informedEntities.set(informed, visibleEntities); + return visibleEntities.map((entity) => { + return entity.mergeDiff(); + }); + } + toJSON() { const json = []; for (let i = 0; i < this._flatEntities.length; i++) {