Created
November 2, 2017 14:48
-
-
Save MHerszak/beb6fc4883d68f7e1753479becd7c23f 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
componentDidMount() { | |
const events = [{ | |
service: 'conversation', | |
event: 'created', | |
eventFunc: this.addConversation, | |
}, | |
{ | |
service: 'conversation', | |
event: 'removed', | |
eventFunc: this.removeConversation, | |
}]; | |
// this makes your events management hard to handle | |
const { app } = this.context; | |
forEach(events, ({ service, event, eventFunc }) => { | |
app.service(service).on(event, eventFunc); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment