Skip to content

Commit f0453a7

Browse files
author
jtassin
committed
debounce - little trick to avoid a random "Scope.eval is not a function" error
1 parent ec4bfe2 commit f0453a7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: src/components/digestMiddleware.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import debounce from 'lodash.debounce';
22

33
export default function digestMiddleware($rootScope, debounceConfig) {
4-
let debouncedFunction = $rootScope.$evalAsync;
4+
let debouncedFunction = (expr) => {
5+
$rootScope.$evalAsync(expr);
6+
};
57
if(debounceConfig && debounceConfig.wait && debounceConfig.wait > 0) {
6-
debouncedFunction = debounce($rootScope.$evalAsync, debounceConfig.wait, { maxWait: debounceConfig.maxWait });
8+
debouncedFunction = debounce(debouncedFunction, debounceConfig.wait, { maxWait: debounceConfig.maxWait });
79
}
810
return store => next => action => {
911
const res = next(action);

0 commit comments

Comments
 (0)