app-redux-utils
Advanced tools
Comparing version 1.7.2 to 1.8.0
@@ -9,5 +9,4 @@ "use strict"; | ||
function controllerMiddleware(options = {}) { | ||
const { watchers = [], container, } = options; | ||
const { watchers = [], container } = options; | ||
return (middlewareAPI) => (next) => (action) => tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
next(action); | ||
let createController; | ||
@@ -43,2 +42,3 @@ if (container) { | ||
} while (!iterator.done); | ||
next(action); | ||
}); | ||
@@ -61,7 +61,13 @@ } | ||
const allWatchers = watchers.concat(implicitWatchers); | ||
allWatchers.forEach(watcher => { | ||
allWatchers.forEach((watcher) => { | ||
const actionName = watcher.get(action.type); | ||
if (actionName) { | ||
const controller = createController(watcher); | ||
promises.push(controller[actionName](action)); | ||
const promise = new Promise((resolve) => { | ||
setTimeout(() => { | ||
controller[actionName](action); | ||
resolve(); | ||
}); | ||
}); | ||
promises.push(promise); | ||
} | ||
@@ -68,0 +74,0 @@ }); |
{ | ||
"name": "app-redux-utils", | ||
"version": "1.7.2", | ||
"version": "1.8.0", | ||
"description": "Helpful utils for redux", | ||
@@ -36,2 +36,3 @@ "contributors": [ | ||
"jest": "28.1.1", | ||
"prettier": "2.7.1", | ||
"ts-jest": "28.0.5", | ||
@@ -38,0 +39,0 @@ "typescript": "4.6.4" |
Sorry, the diff of this file is not supported yet
49851
557
9