mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #33797 from azizhk/redux-batched-subscribe-update
[redux-batched-subscribe] Update redux version
This commit is contained in:
+8
-2
@@ -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,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();
|
||||
|
||||
Reference in New Issue
Block a user