Skip to content

Commit

Permalink
Migrate to ES6
Browse files Browse the repository at this point in the history
  • Loading branch information
tribou committed Oct 15, 2015
1 parent 3577b5e commit 1074e2c
Show file tree
Hide file tree
Showing 16 changed files with 397 additions and 23,130 deletions.
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "airbnb"
}

67 changes: 32 additions & 35 deletions assets/js/actions/TodoActions.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
// Todo actions
var AppDispatcher = require('../dispatcher/AppDispatcher');
var TodoConstants = require('../constants/TodoConstants');
var RandomUserAPI = require('../utils/RandomUserAPI');

module.exports = {

addItem: function() {
AppDispatcher.handleViewAction({
actionType: TodoConstants.NEW_ITEM
});
},

saveItem: function(text) {
AppDispatcher.handleViewAction({
actionType: TodoConstants.SAVE_ITEM,
text: text
});
},

removeItem: function(index) {
AppDispatcher.handleViewAction({
actionType: TodoConstants.REMOVE_ITEM,
index: index
});
},

getRandom: function() {
AppDispatcher.handleViewAction({
actionType: TodoConstants.GET_RANDOM
});

RandomUserAPI.get();
}

};
import AppDispatcher from '../dispatcher/AppDispatcher';
import { TodoConstants } from '../constants/TodoConstants';
import { getRandomApi } from '../utils/RandomUserAPI';


export function addItem() {
AppDispatcher.handleViewAction({
actionType: TodoConstants.NEW_ITEM,
});
}

export function saveItem(text) {
AppDispatcher.handleViewAction({
actionType: TodoConstants.SAVE_ITEM,
text: text,
});
}

export function removeItem(index) {
AppDispatcher.handleViewAction({
actionType: TodoConstants.REMOVE_ITEM,
index: index,
});
}

export function getRandom() {
AppDispatcher.handleViewAction({
actionType: TodoConstants.GET_RANDOM,
});

getRandomApi();
}

18 changes: 8 additions & 10 deletions assets/js/actions/TodoServerActions.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// Todo actions
var AppDispatcher = require('../dispatcher/AppDispatcher');
var TodoConstants = require('../constants/TodoConstants');
import AppDispatcher from '../dispatcher/AppDispatcher';
import { TodoConstants } from '../constants/TodoConstants';

module.exports = {

receiveRandom: function(response) {
AppDispatcher.handleServerAction({
actionType: TodoConstants.GET_RANDOM_RESPONSE,
response: response
});
},
};
export function receiveRandom(response) {
AppDispatcher.handleServerAction({
actionType: TodoConstants.GET_RANDOM_RESPONSE,
response: response,
});
}

Loading

0 comments on commit 1074e2c

Please sign in to comment.