mancala/src/context.tsx

28 lines
692 B
TypeScript
Raw Normal View History

2022-05-15 01:58:57 +03:00
import { Texts, TrTr } from "./const/texts";
import { RTMT } from "./rtmt/rtmt";
import { RTMTWS } from "./rtmt/rtmt_websocket";
import { UserKeyStore, UserKeyStoreImpl } from "./store/key_store";
import ThemeManager from "./theme/ThemeManager";
2021-06-27 19:28:55 +03:00
2022-05-15 01:58:57 +03:00
export type Context = {
rtmt: RTMT;
userKeyStore: UserKeyStore;
texts: Texts;
themeManager: ThemeManager;
};
2021-06-27 19:28:55 +03:00
2022-05-15 01:58:57 +03:00
export const initContext = () => {
const rtmt = new RTMTWS();
const userKeyStore = new UserKeyStoreImpl();
const texts = TrTr;
2022-06-04 19:28:57 +03:00
const themeManager = new ThemeManager();
2022-05-15 01:58:57 +03:00
return {
rtmt: rtmt,
userKeyStore: userKeyStore,
texts: texts,
themeManager,
};
};
2021-06-27 19:28:55 +03:00
2022-05-15 01:58:57 +03:00
export const context: Context = initContext();