-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRoot.tsx
40 lines (34 loc) · 924 Bytes
/
Root.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import * as React from "react";
import "normalize.css";
import { Provider } from "react-redux";
import { ThemeProvider } from "styled-components";
import "theme/index.scss";
import store from "store";
import theme from "theme";
import { openApp, closeApp, bringToTop } from "base/store";
import App from "App";
const Root = () => {
// move to more apporpiate place
React.useEffect(() => {
// init global object
window.os = {
...window.os,
openApp: (param) => store.dispatch(openApp(param)),
closeApp: (param) => store.dispatch(closeApp(param)),
bringToTop: (param) => store.dispatch(bringToTop(param)),
events: {},
};
// housekeeping
return () => {
(window.os as any) = undefined;
};
}, []);
return (
<Provider store={store}>
<ThemeProvider theme={theme}>
<App />
</ThemeProvider>
</Provider>
);
};
export default Root;