mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-17 05:58:41 -09:00
index: expose store in window, use store_ internally
This commit is contained in:
parent
f501b39e40
commit
4a37d3b3d3
1 changed files with 21 additions and 20 deletions
|
|
@ -16,7 +16,7 @@ import { createStore, applyMiddleware } from 'redux';
|
||||||
import HyperTermContainer from './containers/hyperterm';
|
import HyperTermContainer from './containers/hyperterm';
|
||||||
import { loadConfig, reloadConfig } from './actions/config';
|
import { loadConfig, reloadConfig } from './actions/config';
|
||||||
|
|
||||||
const store = createStore(
|
const store_ = createStore(
|
||||||
rootReducer,
|
rootReducer,
|
||||||
applyMiddleware(
|
applyMiddleware(
|
||||||
thunk,
|
thunk,
|
||||||
|
|
@ -26,78 +26,79 @@ const store = createStore(
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
window.__defineGetter__('state', () => store.getState());
|
window.__defineGetter__('store', () => store_);
|
||||||
|
window.__defineGetter__('rpc', () => rpc);
|
||||||
|
|
||||||
// initialize config
|
// initialize config
|
||||||
store.dispatch(loadConfig(config.getConfig()));
|
store_.dispatch(loadConfig(config.getConfig()));
|
||||||
config.subscribe(() => {
|
config.subscribe(() => {
|
||||||
store.dispatch(reloadConfig(config.getConfig()));
|
store_.dispatch(reloadConfig(config.getConfig()));
|
||||||
});
|
});
|
||||||
|
|
||||||
// initialize communication with main electron process
|
// initialize communication with main electron process
|
||||||
// and subscribe to all user intents for example from menues
|
// and subscribe to all user intents for example from menues
|
||||||
rpc.on('ready', () => {
|
rpc.on('ready', () => {
|
||||||
store.dispatch(init());
|
store_.dispatch(init());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session add', ({ uid }) => {
|
rpc.on('session add', ({ uid }) => {
|
||||||
store.dispatch(sessionActions.addSession(uid));
|
store_.dispatch(sessionActions.addSession(uid));
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session data', ({ uid, data }) => {
|
rpc.on('session data', ({ uid, data }) => {
|
||||||
store.dispatch(sessionActions.addSessionData(uid, data));
|
store_.dispatch(sessionActions.addSessionData(uid, data));
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session title', ({ uid, title }) => {
|
rpc.on('session title', ({ uid, title }) => {
|
||||||
store.dispatch(sessionActions.setSessionProcessTitle(uid, title));
|
store_.dispatch(sessionActions.setSessionProcessTitle(uid, title));
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session exit', ({ uid }) => {
|
rpc.on('session exit', ({ uid }) => {
|
||||||
store.dispatch(sessionActions.sessionExit(uid));
|
store_.dispatch(sessionActions.sessionExit(uid));
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session add req', () => {
|
rpc.on('session add req', () => {
|
||||||
store.dispatch(sessionActions.requestSession());
|
store_.dispatch(sessionActions.requestSession());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session close req', () => {
|
rpc.on('session close req', () => {
|
||||||
store.dispatch(sessionActions.userExitActiveSession());
|
store_.dispatch(sessionActions.userExitActiveSession());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session clear req', () => {
|
rpc.on('session clear req', () => {
|
||||||
store.dispatch(sessionActions.clearActiveSession());
|
store_.dispatch(sessionActions.clearActiveSession());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('reset fontSize req', () => {
|
rpc.on('reset fontSize req', () => {
|
||||||
store.dispatch(uiActions.resetFontSize());
|
store_.dispatch(uiActions.resetFontSize());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('increase fontSize req', () => {
|
rpc.on('increase fontSize req', () => {
|
||||||
store.dispatch(uiActions.increaseFontSize());
|
store_.dispatch(uiActions.increaseFontSize());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('decrease fontSize req', () => {
|
rpc.on('decrease fontSize req', () => {
|
||||||
store.dispatch(uiActions.resetFontSize());
|
store_.dispatch(uiActions.resetFontSize());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('move left req', () => {
|
rpc.on('move left req', () => {
|
||||||
store.dispatch(uiActions.moveLeft());
|
store_.dispatch(uiActions.moveLeft());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('move right req', () => {
|
rpc.on('move right req', () => {
|
||||||
store.dispatch(uiActions.moveRight());
|
store_.dispatch(uiActions.moveRight());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('preferences', () => {
|
rpc.on('preferences', () => {
|
||||||
store.dispatch(uiActions.showPreferences());
|
store_.dispatch(uiActions.showPreferences());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('update available', ({ releaseName, releaseNotes }) => {
|
rpc.on('update available', ({ releaseName, releaseNotes }) => {
|
||||||
store.dispatch(updaterActions.updateAvailable(releaseName, releaseNotes));
|
store_.dispatch(updaterActions.updateAvailable(releaseName, releaseNotes));
|
||||||
});
|
});
|
||||||
|
|
||||||
const app = render(
|
const app = render(
|
||||||
<Provider store={ store }>
|
<Provider store={ store_ }>
|
||||||
<HyperTermContainer />
|
<HyperTermContainer />
|
||||||
</Provider>,
|
</Provider>,
|
||||||
document.getElementById('mount')
|
document.getElementById('mount')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue