Created
December 9, 2014 00:55
-
-
Save flarnie/8209fdf07d1d192f5d05 to your computer and use it in GitHub Desktop.
Flux ChatApp Sample 1
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
// The case statement documents which actions this store listens to | |
// ... | |
ThreadStore.dispatchToken = ChatAppDispatcher.register(function(payload) { | |
var action = payload.action; | |
switch(action.type) { | |
case ActionTypes.CLICK_THREAD: | |
_currentID = action.threadID; | |
_threads[_currentID].lastMessage.isRead = true; | |
ThreadStore.emitChange(); | |
break; | |
case ActionTypes.RECEIVE_RAW_MESSAGES: | |
ThreadStore.init(action.rawMessages); | |
ThreadStore.emitChange(); | |
break; | |
default: | |
// do nothing | |
} | |
}); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment