add GameStore

This commit is contained in:
Halit Aksoy 2022-07-15 21:42:38 +03:00
parent d97ae80c67
commit 1b1b931dfc
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,7 @@
import { MancalaGame } from "mancala.js";
export interface GameStore {
get(id: string): MancalaGame | undefined;
set(id: string, game: MancalaGame): void;
remove(id: string): void;
}

View File

@ -0,0 +1,16 @@
import { MancalaGame } from "mancala.js";
import { GameStore } from "./GameStore";
export class GameStoreImpl implements GameStore {
gameStore: Map<string, MancalaGame> = new Map<string, MancalaGame>()
get(id: string): MancalaGame | undefined {
return this.gameStore.get(id);
}
set(id: string, game: MancalaGame): void {
this.gameStore.set(id, game);
}
remove(id: string): void {
this.gameStore.delete(id);
}
}