File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 1- let toRun ;
1+ import debounce from 'lodash.debounce' ;
22
33export default function digestMiddleware ( $rootScope , debounceConfig ) {
4+ let debouncedFunction = $rootScope . $evalAsync ;
5+ if ( debounceConfig && debounceConfig . wait && debounceConfig . wait > 0 ) {
6+ debouncedFunction = debounce ( $rootScope . $evalAsync , debounceConfig . wait , { maxWait : debounceConfig . maxWait } ) ;
7+ }
48 return store => next => action => {
59 const res = next ( action ) ;
6- if ( debounceConfig && debounceConfig . wait && debounceConfig . wait > 0 ) {
7- toRun = res ;
8- window . setTimeout ( ( ) => {
9- $rootScope . $evalAsync ( toRun ) ;
10- toRun = undefined ;
11- } , debounceConfig . wait ) ;
12- } else {
13- $rootScope . $evalAsync ( toRun ) ;
14- }
10+ debouncedFunction ( res ) ;
1511 return res ;
1612 } ;
1713}
You can’t perform that action at this time.
0 commit comments