add enhancer

typescript
Yanick Champoux 2021-10-18 08:00:47 -04:00
parent 55812ed6d8
commit a8f97940e8
1 changed files with 5 additions and 2 deletions

View File

@ -322,7 +322,10 @@ export class Updux {
};
}
createStore(initial?: unknown) {
createStore(initial?: unknown, enhancerGenerator?: Function) {
const enhancer = (enhancerGenerator ?? applyMiddleware)(this.middleware);
const store : {
getState: Function & Record<string,Function>,
dispatch: Function & Record<string,Function>,
@ -331,7 +334,7 @@ export class Updux {
} = reduxCreateStore(
this.reducer,
initial ?? this.initial,
applyMiddleware(this.middleware)
enhancer
) as any;
store.actions = this.actions;