Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarhane committed Oct 13, 2017
1 parent d8efa9b commit 48db676
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/browser/components/DesktopIntegration/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,16 @@ import { Component } from 'preact'
import { getActiveGraph, getCredentials, eventToHandler } from './helpers'

export default class DesktopIntegration extends Component {
state = {
listenerSetup: false,
cachedConnectionCredentials: {}
}
setupListener = props => {
if (this.state.listenerSetup) return
const { integrationPoint } = props
// Run on context updates
if (integrationPoint && integrationPoint.onContextUpdate) {
const listenerSetup = () =>
integrationPoint.onContextUpdate((event, newContext, oldContext) => {
const handlerPropName = eventToHandler(event.type)
if (!handlerPropName) return
if (typeof this.props[handlerPropName] === 'undefined') return
this.props[handlerPropName](event, newContext, oldContext)
})
this.setState({ listenerSetup: true }, listenerSetup)
integrationPoint.onContextUpdate((event, newContext, oldContext) => {
const handlerPropName = eventToHandler(event.type)
if (!handlerPropName) return
if (typeof this.props[handlerPropName] === 'undefined') return
this.props[handlerPropName](event, newContext, oldContext)
})
}
}
checkContextForActiveConnection = props => {
Expand All @@ -63,9 +56,6 @@ export default class DesktopIntegration extends Component {
this.checkContextForActiveConnection(this.props)
this.setupListener(this.props)
}
componentWillReceiveProps (props) {
this.setupListener(props)
}
render = () => {
return null
}
Expand Down

0 comments on commit 48db676

Please sign in to comment.