Created
March 1, 2016 21:07
-
-
Save JLarky/06f1e07321ced56c08e4 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) => { | |
switch(action.type) { | |
case GreetingActionTypes.ADD_GREETING: | |
let payload1 = (<AddGreetingEvent> action).payload; | |
this._state.newGreeting = ''; | |
this._state.greetings = this._state.greetings.concat(payload1); | |
this.emitChange(); | |
break; | |
case GreetingActionTypes.REMOVE_GREETING: | |
let payload2 = (<RemoveGreeting> action).payload; | |
this._state.greetings = this._state.greetings.filter(g => g !== payload2); | |
this.emitChange(); | |
break; | |
case GreetingActionTypes.NEW_GREETING_CHANGED: | |
let payload3 = (<NewGreetingChanged> action).payload; | |
this._state.newGreeting = payload3; | |
this.emitChange(); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment