Skip to content

Commit a51d90b

Browse files
authored
Merge pull request #266 from paulkaplan/fix-listener-functions
Change #off to #removeListener
2 parents 47d6cf7 + 7ad841d commit a51d90b

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/containers/blocks.jsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ class Blocks extends React.Component {
5656
.getFlyout()
5757
.getWorkspace()
5858
.addChangeListener(this.props.vm.flyoutBlockListener);
59-
this.props.vm.on('SCRIPT_GLOW_ON', this.onScriptGlowOn);
60-
this.props.vm.on('SCRIPT_GLOW_OFF', this.onScriptGlowOff);
61-
this.props.vm.on('BLOCK_GLOW_ON', this.onBlockGlowOn);
62-
this.props.vm.on('BLOCK_GLOW_OFF', this.onBlockGlowOff);
63-
this.props.vm.on('VISUAL_REPORT', this.onVisualReport);
64-
this.props.vm.on('workspaceUpdate', this.onWorkspaceUpdate);
59+
this.props.vm.addListener('SCRIPT_GLOW_ON', this.onScriptGlowOn);
60+
this.props.vm.addListener('SCRIPT_GLOW_OFF', this.onScriptGlowOff);
61+
this.props.vm.addListener('BLOCK_GLOW_ON', this.onBlockGlowOn);
62+
this.props.vm.addListener('BLOCK_GLOW_OFF', this.onBlockGlowOff);
63+
this.props.vm.addListener('VISUAL_REPORT', this.onVisualReport);
64+
this.props.vm.addListener('workspaceUpdate', this.onWorkspaceUpdate);
6565
}
6666
detachVM () {
67-
this.props.vm.off('SCRIPT_GLOW_ON', this.onScriptGlowOn);
68-
this.props.vm.off('SCRIPT_GLOW_OFF', this.onScriptGlowOff);
69-
this.props.vm.off('BLOCK_GLOW_ON', this.onBlockGlowOn);
70-
this.props.vm.off('BLOCK_GLOW_OFF', this.onBlockGlowOff);
71-
this.props.vm.off('VISUAL_REPORT', this.onVisualReport);
72-
this.props.vm.off('workspaceUpdate', this.onWorkspaceUpdate);
67+
this.props.vm.removeListener('SCRIPT_GLOW_ON', this.onScriptGlowOn);
68+
this.props.vm.removeListener('SCRIPT_GLOW_OFF', this.onScriptGlowOff);
69+
this.props.vm.removeListener('BLOCK_GLOW_ON', this.onBlockGlowOn);
70+
this.props.vm.removeListener('BLOCK_GLOW_OFF', this.onBlockGlowOff);
71+
this.props.vm.removeListener('VISUAL_REPORT', this.onVisualReport);
72+
this.props.vm.removeListener('workspaceUpdate', this.onWorkspaceUpdate);
7373
}
7474
onWorkspaceMetricsChange () {
7575
const target = this.props.vm.editingTarget;

src/containers/green-flag.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class GreenFlag extends React.Component {
1616
this.state = {projectRunning: false};
1717
}
1818
componentDidMount () {
19-
this.props.vm.on('PROJECT_RUN_START', this.onProjectRunStart);
20-
this.props.vm.on('PROJECT_RUN_STOP', this.onProjectRunStop);
19+
this.props.vm.addListener('PROJECT_RUN_START', this.onProjectRunStart);
20+
this.props.vm.addListener('PROJECT_RUN_STOP', this.onProjectRunStop);
2121
}
2222
componentWillUnmount () {
23-
this.props.vm.off('PROJECT_RUN_START', this.onProjectRunStart);
24-
this.props.vm.off('PROJECT_RUN_STOP', this.onProjectRunStop);
23+
this.props.vm.removeListener('PROJECT_RUN_START', this.onProjectRunStart);
24+
this.props.vm.removeListener('PROJECT_RUN_STOP', this.onProjectRunStop);
2525
}
2626
onProjectRunStart () {
2727
this.setState({projectRunning: true});

src/containers/stop-all.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class StopAll extends React.Component {
1515
this.state = {projectRunning: false};
1616
}
1717
componentDidMount () {
18-
this.props.vm.on('PROJECT_RUN_START', this.onProjectRunStart);
19-
this.props.vm.on('PROJECT_RUN_STOP', this.onProjectRunStop);
18+
this.props.vm.addListener('PROJECT_RUN_START', this.onProjectRunStart);
19+
this.props.vm.addListener('PROJECT_RUN_STOP', this.onProjectRunStop);
2020
}
2121
componentWillUnmount () {
22-
this.props.vm.off('PROJECT_RUN_START', this.onProjectRunStart);
23-
this.props.vm.off('PROJECT_RUN_STOP', this.onProjectRunStop);
22+
this.props.vm.removeListener('PROJECT_RUN_START', this.onProjectRunStart);
23+
this.props.vm.removeListener('PROJECT_RUN_STOP', this.onProjectRunStop);
2424
}
2525
onProjectRunStart () {
2626
this.setState({projectRunning: true});

0 commit comments

Comments
 (0)