1.0.1 • Published 7 years ago

action-types-creator v1.0.1

Weekly downloads
6
License
ISC
Repository
github
Last release
7 years ago

action type creator for react or vue

we don't want

export const USER_UPDATE = 'USER_UPDATE';
export const USER_LOAD = 'USER_LOAD';
export const USER_LOAD_REQUEST = 'USER_LOAD_REQUEST';
export const USER_LOAD_SUCCESS = 'USER_LOAD_SUCCESS';
export const USER_LOAD_FAILURE = 'USER_LOAD_FAILURE';

what about this

const types = {
	user: [ 'UPDATE',  '_LOAD_' ]
}

#Usage

  1. npm install --save action-types-creator

  2. create file something like actions.js

import { createActionType } from 'action-types-creator';

export let user = createActionType('user', ['UPDATE', '_LOAD_']);

then

import { user } from './to/path/actions.js';

console.log(user.UPDATE); // USER_UPDATE
console.log(user.LOAD); //  USER_LOAD
console.log(user.LOAD_REQUEST); //  USER_LOAD_REQUEST
console.log(user.LOAD_SUCCESS); //  USER_LOAD_SUCCESS
console.log(user.LOAD_FAILURE); //  USER_LOAD_FAILURE

enjoy

1.0.1

7 years ago

1.0.0

7 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago