Refactoring with a MapStore
A great deal of the complexity of the current code is that we must chain 2 reactive values (one in the map "GameScene.MapPlayersByKey" and one in the snapshot store). The new generic MapStore class can be used to listen to stores inside a map. When the store inside the map, or the map itself is modified, the resulting store is updated.
This commit is contained in:
parent
bbe539b785
commit
0e68490e75
11 changed files with 277 additions and 83 deletions
|
@ -12,7 +12,7 @@ let idCount = 0;
|
|||
function createPlayersStore() {
|
||||
let players = new Map<number, PlayerInterface>();
|
||||
|
||||
const { subscribe, set, update } = writable(players);
|
||||
const { subscribe, set, update } = writable<Map<number, PlayerInterface>>(players);
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue