index wip
This commit is contained in:
parent
125800a8b9
commit
0949200bac
@ -12,4 +12,5 @@ export type Mutation<S=any> = (payload: any, action: Action) => (state: S) => S
|
|||||||
export type ActionCreator = (...args: any[] ) => Action;
|
export type ActionCreator = (...args: any[] ) => Action;
|
||||||
|
|
||||||
export type UpduxConfig = Partial<{
|
export type UpduxConfig = Partial<{
|
||||||
|
subduxes: {}
|
||||||
}>;
|
}>;
|
||||||
|
@ -6,14 +6,17 @@ import buildMutations from './buildMutations';
|
|||||||
import buildCreateStore from './buildCreateStore';
|
import buildCreateStore from './buildCreateStore';
|
||||||
import buildMiddleware from './buildMiddleware';
|
import buildMiddleware from './buildMiddleware';
|
||||||
import buildUpreducer from './buildUpreducer';
|
import buildUpreducer from './buildUpreducer';
|
||||||
|
import { UpduxConfig, Dictionary } from './types';
|
||||||
|
|
||||||
export class Updux {
|
export class Updux {
|
||||||
|
|
||||||
constructor(config) {
|
subduxes: Dictionary<Updux>;
|
||||||
|
|
||||||
|
constructor(config: UpduxConfig) {
|
||||||
|
|
||||||
this.subduxes = fp.mapValues(
|
this.subduxes = fp.mapValues(
|
||||||
value => fp.isPlainObject(value) ? new Updux(value ) : value )(fp.getOr({},'subduxes',config)
|
(value:UpduxConfig|Updux) => fp.isPlainObject(value) ? new Updux(value) : value )(fp.getOr({},'subduxes',config)
|
||||||
);
|
) as Dictionary<Updux>;
|
||||||
|
|
||||||
|
|
||||||
this.actions = buildActions(
|
this.actions = buildActions(
|
Loading…
Reference in New Issue
Block a user