ReduxCoreDraft.js 473 B

123456789101112131415161718192021222324
  1. import { createStore, combineReducers } from 'redux'
  2. export default class Core {
  3. constructor (opts) {
  4. this.opts = opts
  5. }
  6. parseFiles (files) {
  7. // parse file or files
  8. }
  9. use (Plugin, opts) {
  10. // ... is same thing as using Object.assign
  11. this.reducers = combineReducers({
  12. // [plugin.id]: plugin.reducer,
  13. // ...this.reducers
  14. })
  15. }
  16. init () {
  17. this.store = createStore(this.reducers)
  18. this.dispatch = this.store.dispatch
  19. }
  20. }