Skip to content

Commit 4372bb5

Browse files
author
jtassin
committed
Doc for debounce
1 parent 93e1cbb commit 4372bb5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ For Angular 2 see [ng2-redux](https://github.com/wbuchwalter/ng2-redux).
1717
- [API](#api)
1818
- [Dependency Injectable Middleware](#dependency-injectable-middleware)
1919
- [Routers](#routers)
20-
- [Debouncing the digest](#debouncing-the-digest)
20+
- [Config](#config)
2121
- [Using DevTools](#using-devtools)
2222
- [Additional Resources](#additional-resources)
2323

@@ -189,7 +189,9 @@ $ngReduxProvider.createStoreWith(reducers, [thunk, 'myInjectableMiddleware']);
189189

190190
Middlewares passed as **string** will then be resolved throught angular's injector.
191191

192-
## Debouncing the digest
192+
## Config
193+
194+
### Debouncing the digest
193195
You can debounce the digest triggered by store modification (usefull in huge apps with a lot of store modification) by passing a config parameter to the `ngReduxProvider`.
194196

195197
```javascript
@@ -201,11 +203,14 @@ angular.module('ngapplication').config(($ngReduxProvider) => {
201203
// eslint-disable-next-line
202204
$ngReduxProvider.config.debounce = {
203205
wait: 100,
206+
mawWait: 500,
204207
};
205208
});
206209
```
207210

208-
This will debounce the digest 100ms. Every store modification within this time will be handled by this digest.
211+
This will debounce the digest for 100ms with a maximum defaly time of 500ms. Every store modification within this time will be handled by this digest.
212+
213+
[lodash.debounce](https://lodash.com/docs/4.17.4#debounce) is used for the debouncing.
209214

210215
## Routers
211216
See [redux-ui-router](https://github.com/neilff/redux-ui-router) to make ng-redux and UI-Router work together. <br>

0 commit comments

Comments
 (0)