Merge pull request #33797 from azizhk/redux-batched-subscribe-update

[redux-batched-subscribe] Update redux version
This commit is contained in:
Sheetal Nandi
2019-03-18 12:53:01 -07:00
committed by GitHub
3 changed files with 16 additions and 4 deletions
+8 -2
View File
@@ -1,11 +1,17 @@
// Type definitions for redux-batched-subscribe 0.1
// Project: https://github.com/tappleby/redux-batched-subscribe
// Definitions by: Dibyo Majumdar <https://github.com/mDibyo>
// Aziz Khambati <https://github.com/azizhk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { GenericStoreEnhancer } from 'redux';
import { Store, StoreEnhancer } from 'redux';
export type NotifyFunction = () => void;
export type BatchFunction = (notify: NotifyFunction) => void;
export function batchedSubscribe(batch: BatchFunction): GenericStoreEnhancer;
export interface StoreExtension {
subscribeImmediate: Store["subscribe"];
}
export function batchedSubscribe(batch: BatchFunction): StoreEnhancer<StoreExtension>;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"redux": ">=1.0.0 <4.0.0"
"redux": "^4.0.0"
}
}
@@ -23,7 +23,13 @@ const asyncNotify: BatchFunction = (() => {
};
})();
const store: Store<State> = createStore(
const store = createStore(
rootReducer,
batchedSubscribe(asyncNotify)
);
const unsubscribe = store.subscribeImmediate(() => {
store.getState();
});
unsubscribe();