import { server } from "../const/config"; import { Texts, TrTr } from "../const/texts"; import { RTMT } from "../rtmt/rtmt"; import { RTMTWS } from "../rtmt/rtmt_websocket"; import { HttpServiceImpl } from "../service/HttpService"; import { GameStore, GameStoreImpl } from "../store/GameStore"; import { UserKeyStore, UserKeyStoreImpl } from "../store/KeyStore"; import ThemeManager from "../theme/ThemeManager"; export type Context = { rtmt: RTMT; userKeyStore: UserKeyStore; texts: Texts; themeManager: ThemeManager; gameStore: GameStore; }; export const initContext = (): Context => { const rtmt = new RTMTWS(); const httpService = new HttpServiceImpl(server.serverAdress); const userKeyStore = new UserKeyStoreImpl({ httpService }); const gameStore = new GameStoreImpl({ httpService }); const texts = TrTr; const themeManager = new ThemeManager(); return { rtmt: rtmt, userKeyStore: userKeyStore, texts: texts, themeManager, gameStore }; };