From 76a75c91202876a5ca0a2c6001f9e40b5aadf408 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Wed, 23 Oct 2019 14:44:12 -0400 Subject: [PATCH] wip --- src/types.ts | 9 ++++++++- src/updux.ts | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index 782d9a7..b1df809 100644 --- a/src/types.ts +++ b/src/types.ts @@ -9,8 +9,15 @@ export type Dictionary = { [key: string]: T }; export type Mutation = (payload: any, action: Action) => (state: S) => S ; +type ActionPayloadGenerator = (...args:any[]) => any; + export type ActionCreator = (...args: any[] ) => Action; export type UpduxConfig = Partial<{ - subduxes: {} + subduxes: {}, + actions: { + [ type: string ]: ActionPayloadGenerator + }, + mutations: any, + effects: any, }>; diff --git a/src/updux.ts b/src/updux.ts index 1af27a5..cbe237b 100644 --- a/src/updux.ts +++ b/src/updux.ts @@ -6,12 +6,15 @@ import buildMutations from './buildMutations'; import buildCreateStore from './buildCreateStore'; import buildMiddleware from './buildMiddleware'; import buildUpreducer from './buildUpreducer'; -import { UpduxConfig, Dictionary } from './types'; +import { UpduxConfig, Dictionary, Action, ActionCreator } from './types'; + export class Updux { subduxes: Dictionary; + actions: Dictionary + constructor(config: UpduxConfig) { this.subduxes = fp.mapValues(