Skip to content

Instantly share code, notes, and snippets.

@salanki
Last active August 11, 2016 06:52
Show Gist options
  • Save salanki/a37d8b79c669d7dd10333d2603a84ba3 to your computer and use it in GitHub Desktop.
Save salanki/a37d8b79c669d7dd10333d2603a84ba3 to your computer and use it in GitHub Desktop.
function generator(baseType) {
// Need to handle variable length argument lists
const fun = (payload) => ({
type: fun,
payload: payload,
baseType: baseType
});
return fun;
}
function createAction() {
const fun = () => ({
REQUEST: generator(fun),
SUCCESS: generator(fun),
ERROR: generator(fun)
});
return fun();
}
FETCH_FEED = createAction();
FETCH_APPLE = createAction();
feed_request = FETCH_FEED.REQUEST('nothing');
apple_request = FETCH_APPLE.REQUEST('nothing');
feed_request.type == FETCH_FEED.REQUEST;
apple_request.type == FETCH_APPLE.REQUEST;
feed_request.type != FETCH_APPLE.REQUEST;
feed_request.type != apple_request.type;
feed_request.type != FETCH_FEED.SUCCESS;
feed_success = FETCH_FEED.SUCCESS('nothing');
feed_request.type != feed_success.type
feed_request.baseType == feed_success.baseType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment