diff --git a/examples/chat/js/actions/ChatServerActionCreators.js b/examples/chat/js/actions/ChatServerActionCreators.js index 9aa92f40..00a1e4bc 100644 --- a/examples/chat/js/actions/ChatServerActionCreators.js +++ b/examples/chat/js/actions/ChatServerActionCreators.js @@ -1,34 +1,9 @@ -/** - * This file is provided by Facebook for testing and evaluation purposes - * only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +var alt = require('../alt') -var ChatAppDispatcher = require('../dispatcher/ChatAppDispatcher'); -var ChatConstants = require('../constants/ChatConstants'); - -var ActionTypes = ChatConstants.ActionTypes; - -module.exports = { - - receiveAll: function(rawMessages) { - ChatAppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVE_RAW_MESSAGES, - rawMessages: rawMessages - }); - }, - - receiveCreatedMessage: function(createdMessage) { - ChatAppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVE_RAW_CREATED_MESSAGE, - rawMessage: createdMessage - }); +class ChatServerActions { + constructor() { + this.generateActions('receiveCreatedMessage', 'receiveAll') } +} -}; +module.exports = alt.createActions(ChatServerActions) diff --git a/examples/chat/js/actions/ChatThreadActionCreators.js b/examples/chat/js/actions/ChatThreadActionCreators.js index fa63c9cd..e0ffe189 100644 --- a/examples/chat/js/actions/ChatThreadActionCreators.js +++ b/examples/chat/js/actions/ChatThreadActionCreators.js @@ -1,27 +1,9 @@ -/** - * This file is provided by Facebook for testing and evaluation purposes - * only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +var alt = require('../alt') -var ChatAppDispatcher = require('../dispatcher/ChatAppDispatcher'); -var ChatConstants = require('../constants/ChatConstants'); - -var ActionTypes = ChatConstants.ActionTypes; - -module.exports = { - - clickThread: function(threadID) { - ChatAppDispatcher.handleViewAction({ - type: ActionTypes.CLICK_THREAD, - threadID: threadID - }); +class ChatThreadActions { + constructor() { + this.generateActions('clickThread') } +} -}; +module.exports = alt.createActions(ChatThreadActions)