Last active
August 29, 2015 14:18
-
-
Save solomonhawk/fde18a89b9d9ad1db25c 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
let validActions = { | |
[GameConstants.GAME_CREATE]: null, | |
[GameConstants.GAME_JOIN]: null, | |
[GameConstants.GAME_EXIT]: null, | |
[GameConstants.USER_JOINED]: null, | |
[GameConstants.USER_LEFT]: null | |
} | |
GameDispatcher.register( ({actionType, data}) => { | |
if (actionType in validActions) { | |
update(data) | |
GameStore.emitChange() | |
} | |
}) |
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
// OR | |
let validActions = [ | |
GameConstants.GAME_CREATE, | |
GameConstants.GAME_JOIN, | |
GameConstants.GAME_EXIT, | |
GameConstants.USER_JOINED, | |
GameConstants.USER_LEFT | |
] | |
GameDispatcher.register( ({actionType, data}) => { | |
if (validActions.contains(actionType)) { | |
update(data) | |
GameStore.emitChange() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment