From a8f97940e85abab6b1a9cbb357bfc978b67b28b4 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Mon, 18 Oct 2021 08:00:47 -0400 Subject: [PATCH] add enhancer --- src/Updux.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Updux.ts b/src/Updux.ts index fbb65d3..82b0d88 100644 --- a/src/Updux.ts +++ b/src/Updux.ts @@ -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, dispatch: Function & Record, @@ -331,7 +334,7 @@ export class Updux { } = reduxCreateStore( this.reducer, initial ?? this.initial, - applyMiddleware(this.middleware) + enhancer ) as any; store.actions = this.actions;