29 lines
891 B
TypeScript
29 lines
891 B
TypeScript
import { server } from "../const/config";
|
|
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;
|
|
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 themeManager = new ThemeManager();
|
|
return {
|
|
rtmt: rtmt,
|
|
userKeyStore: userKeyStore,
|
|
themeManager,
|
|
gameStore
|
|
};
|
|
};
|