Created
March 1, 2016 21:07
-
-
Save JLarky/fb316a3f5c74887a2e20 to your computer and use it in GitHub Desktop.
This file contains 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
const onDispatch = (action: Event) => { | |
if (action instanceof AddGreetingEvent) { | |
const {payload} = action; | |
this._state.newGreeting = ''; | |
this._state.greetings = this._state.greetings.concat(payload); | |
this.emitChange(); | |
} else if (action instanceof RemoveGreeting) { | |
const {payload} = action; | |
this._state.greetings = this._state.greetings.filter(g => g !== payload); | |
this.emitChange(); | |
} else if (action instanceof NewGreetingChanged) { | |
const {payload} = action; | |
this._state.newGreeting = payload; | |
this.emitChange(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment