Created
June 14, 2017 22:58
-
-
Save orangewolf/0d2d4a2109525186a8c1e489b5125b14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| } | |
| + this.onUpdateMessage = this.updateMessage.bind(this) | |
| + this.onUpdateUser = this.updateUser.bind(this) | |
| + this.onUpdateEvent = this.updateEvent.bind(this) | |
| } | |
| componentWillMount(){ | |
| - eventStore.on('current event fetched', this.updateMessage.bind(this)); | |
| - eventStore.on('votes counted', this.updateMessage.bind(this)); | |
| - userStore.on('voted set to false', this.updateUser.bind(this)); | |
| - eventStore.on('new event created', this.updateEvent.bind(this)); | |
| + eventStore.on('current event fetched', this.onUpdateMessage); | |
| + eventStore.on('votes counted', this.onUpdateMessage); | |
| + userStore.on('voted set to false', this.onUpdateUser); | |
| + eventStore.on('new event created', this.onUpdateEvent); | |
| + } | |
| + | |
| + componentWillUnmount(){ | |
| + eventStore.removeListener('current event fetched', this.onUpdateMessage); | |
| + eventStore.removeListener('votes counted', this.onUpdateMessage); | |
| + userStore.removeListener('voted set to false', this.onUpdateUser); | |
| + eventStore.removeListener('new event created', this.onUpdateEvent); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment