From 16a28eca258e07d45c7e2a8ee95368d4eb077d4d Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 15 Jun 2016 01:18:10 +0800 Subject: [web] websocket --- web/src/js/components/ProxyApp.jsx | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'web/src/js/components/ProxyApp.jsx') diff --git a/web/src/js/components/ProxyApp.jsx b/web/src/js/components/ProxyApp.jsx index 81272268..2aedba7c 100644 --- a/web/src/js/components/ProxyApp.jsx +++ b/web/src/js/components/ProxyApp.jsx @@ -1,14 +1,15 @@ -import React, { Component, PropTypes } from "react" -import ReactDOM from "react-dom" -import _ from "lodash" +import React, { Component, PropTypes } from 'react' +import ReactDOM from 'react-dom' +import _ from 'lodash' import { connect } from 'react-redux' -import { Splitter } from "./common.js" -import Header from "./Header" -import EventLog from "./EventLog" -import Footer from "./Footer" -import { SettingsStore } from "../store/store.js" -import { Key } from "../utils.js" +import { Splitter } from './common.js' +import { connect as wsConnect } from '../ducks/websocket' +import Header from './Header' +import EventLog from './EventLog' +import Footer from './Footer' +import { SettingsStore } from '../store/store.js' +import { Key } from '../utils.js' class ProxyAppMain extends Component { @@ -37,6 +38,10 @@ class ProxyAppMain extends Component { this.onSettingsChange = this.onSettingsChange.bind(this) } + componentWillMount() { + this.props.wsConnect() + } + /** * @todo move to actions */ @@ -166,5 +171,8 @@ class ProxyAppMain extends Component { export default connect( state => ({ showEventLog: state.eventLog.visible - }) + }), + { + wsConnect, + } )(ProxyAppMain) -- cgit v1.2.3 From 6c0511b06fdc359ec4c48879f803c80d7fbeb34c Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 18 Jun 2016 14:11:42 +0800 Subject: [web] add app ducks --- web/src/js/components/ProxyApp.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'web/src/js/components/ProxyApp.jsx') diff --git a/web/src/js/components/ProxyApp.jsx b/web/src/js/components/ProxyApp.jsx index b5d59b76..11c321e7 100644 --- a/web/src/js/components/ProxyApp.jsx +++ b/web/src/js/components/ProxyApp.jsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom' import _ from 'lodash' import { connect } from 'react-redux' -import { connect as wsConnect } from '../ducks/websocket' +import { init as appInit, destruct as appDestruct } from '../ducks/app' import Header from './Header' import EventLog from './EventLog' import Footer from './Footer' @@ -37,7 +37,7 @@ class ProxyAppMain extends Component { } componentWillMount() { - this.props.wsConnect() + this.props.appInit() } /** @@ -79,6 +79,7 @@ class ProxyAppMain extends Component { * @todo stop listening to window's key events */ componentWillUnmount() { + this.props.appDestruct() this.settingsStore.removeListener('recalculate', this.onSettingsChange) } @@ -168,6 +169,7 @@ export default connect( showEventLog: state.eventLog.visible }), { - wsConnect, + appInit, + appDestruct, } )(ProxyAppMain) -- cgit v1.2.3