mancala/src/context.tsx

29 lines
753 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 defaultTheme from "./theme/DefaultTheme";
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;
const themeManager = new ThemeManager(defaultTheme);
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();