flux templete generator
flux component generator
This generator generates some templates for facebook/flux component.
$ npm install -g https://github.com/shoponpon/flux-gen.git
$ flux-gen action [actionname] [dispatcherPath]
$ flux-gen dispatcher
$ flux-gen action [storename] [dispatcherPath]
$ flux-gen action image ./Dispatcher.js
import ImageActionTypes from './ImageActionTypes'
import Dispatcher from './Dispatcher'
const ImageActions = {}
export default ImageActions
const ImageActionTypes = {}
export default ImageActionTypes
$ flux-gen store image ./Dispatcher.js
import { ReduceStore } from 'flux/utils'
import Dispatcher from './Dispatcher'
class ImageStore extends ReduceStore {
constructor() {
super(Dispatcher)
}
getInitialState() {
return {}
}
reduce(state, action) {
switch (action.type) {
default:
break
}
return Object.assign({}, state)
}
}
export default new ImageStore()
$ flux-gen dispatcher
import { Dispatcher } from 'flux'
export default new Dispatcher()