-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.js
42 lines (34 loc) · 1.09 KB
/
index.js
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
import React from 'react';
import debugMenu from 'debug-menu';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import inputMenu from 'electron-input-menu';
import context from 'electron-contextmenu-middleware';
import {createStore} from 'redux';
import {receiveActions} from './modules/electron-xproc-redux';
import AppContainer from './containers/app';
import app from './reducers/app';
import {openTunnelsAtStartup, loadStore} from './action-creators';
import middlewares from './middlewares';
function startApp() {
context.use(inputMenu);
context.use(debugMenu.middleware);
context.activate();
inputMenu.registerShortcuts();
document.body.classList.add(
'platform-' + process.platform
);
const store = createStore(app, middlewares);
const main = document.createElement('div');
document.body.appendChild(main);
render(
<Provider store={store}>
<AppContainer/>
</Provider>,
main
);
store.dispatch(receiveActions);
store.dispatch(loadStore());
store.dispatch(openTunnelsAtStartup(store.getState().list));
}
document.addEventListener('DOMContentLoaded', startApp);