Skip to content

Commit e8d2462

Browse files
author
Mike Chen
committed
Clean up middleware docs
* Fixed reference to ordering of AsyncActions.md * Fixed interval/timeout consistency in examples
1 parent 3c9efaf commit e8d2462

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/advanced/Middleware.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ The implementation of [`applyMiddleware()`](../api/applyMiddleware.md) that ship
269269
* It only exposes a subset of the [store API](../api/Store.md) to the middleware: [`dispatch(action)`](../api/Store.md#dispatch) and [`getState()`](../api/Store.
270270
md#getState).
271271

272-
* It does a bit of trickery to make sure that if you call `store.dispatch(action)` from your middleware instead of `next(action)`, the action will actually travel the whole middleware chain again, including the current middleware. This is useful for asynchronous middleware, as we will see [later](AsyncActions.md).
272+
* It does a bit of trickery to make sure that if you call `store.dispatch(action)` from your middleware instead of `next(action)`, the action will actually travel the whole middleware chain again, including the current middleware. This is useful for asynchronous middleware, as we have seen [previously](AsyncActions.md).
273273

274274
* To ensure that you may only apply middleware once, it operates on `createStore()` rather than on `store` itself. Instead of `(store, middlewares) => store`, its signature is `(...middlewares) => (createStore) => createStore`.
275275

@@ -361,20 +361,20 @@ const crashReporter = store => next => action => {
361361

362362
/**
363363
* Schedules actions with { meta: { delay: N } } to be delayed by N milliseconds.
364-
* Makes `dispatch` return a function to cancel the interval in this case.
364+
* Makes `dispatch` return a function to cancel the timeout in this case.
365365
*/
366366
const timeoutScheduler = store => next => action => {
367367
if (!action.meta || !action.meta.delay) {
368368
return next(action);
369369
}
370370

371-
let intervalId = setTimeout(
371+
let timeoutId = setTimeout(
372372
() => next(action),
373373
action.meta.delay
374374
);
375375

376376
return function cancel() {
377-
clearInterval(intervalId);
377+
clearTimeout(timeoutId);
378378
};
379379
};
380380

0 commit comments

Comments
 (0)