-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.tsx
84 lines (71 loc) · 2.64 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import ReactDOM from 'react-dom';
// import configureMobx from 'mobxConfig';
import App from 'App';
import 'Fonts.css';
import HardwareEvents from 'helpers/HardwareEvents';
import hardwareEventHandler from 'eventhandler/HardwareEventHandler';
import MockHardwareEvents from 'helpers/MockHardwareEvents';
import InterappActions from 'middleware/InterappActions';
import MiddlewareRequest from 'middleware/MiddlewareRequest';
import StoreProvider from './context/store';
import { RootStore } from 'store/RootStore';
import Socket from 'Socket';
import MiddlewareActions from 'middleware/MiddlewareActions';
import MiddlewareStorage from 'middleware/MiddlewareStorage';
import ErrorHandler from 'eventhandler/ErrorHandler';
import Backtrace from 'helpers/Backtrace';
import RequestLogger from 'helpers/RequestLogger';
import { no_wamp_session_destroyed } from 'eventhandler/ErrorHandlerFilters';
import { migrateAllFromLocalStorage } from 'system/StorageMigration';
const rootElement = document.getElementById('root');
const isProduction = process.env.NODE_ENV === 'production';
// we're working with the prod build so this was compiled out, it seems
/*if (!isProduction) {
configureMobx();
}*/
// Setup websocket connection
const requestLogger = new RequestLogger();
const socket = new Socket(requestLogger);
const middlewareActions = new MiddlewareActions(socket);
const middlewareRequest = new MiddlewareRequest(socket);
const middlewareStorage = new MiddlewareStorage(socket);
const interappActions = new InterappActions(middlewareRequest);
migrateAllFromLocalStorage(middlewareStorage);
requestLogger.interappActions = interappActions;
const backtrace = new Backtrace(socket, interappActions);
const errorHandler = new ErrorHandler(
interappActions,
backtrace,
[no_wamp_session_destroyed],
isProduction,
);
/*
window.addEventListener('error', errorHandler.onError);
window.addEventListener(
'unhandledrejection',
errorHandler.onUnhandledRejection,
);*/
// Setup mobx stores
export const rootStore = new RootStore(
interappActions,
middlewareActions,
middlewareStorage,
socket,
errorHandler,
);
// Setup hardware event listeners
const hardwareEvents = new HardwareEvents();
hardwareEventHandler.handleEvents(hardwareEvents, rootStore);
const mockHardwareEvents = new MockHardwareEvents(hardwareEvents);
mockHardwareEvents.startListening();
ReactDOM.render(
<StoreProvider store={rootStore}>
<App />
</StoreProvider>,
rootElement,
);
export type IntersectionObserverProps = any;
export type PlainChildrenProps = any;
export type ObserverInstanceCallback = (...args: any[]) => void;
export type InViewHookResponse = any;
export type IntersectionOptions = any;