aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-10 03:22:46 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-10 03:22:46 +0800
commit474db7c18de63429f72511796291ff135c77f10b (patch)
tree63eee7214fafd8d69cb982036906a6c1e651b7d7 /packages/instant/src/util
parent39657b633bd386526f5772238cbebfb976427c07 (diff)
downloaddexon-sol-tools-474db7c18de63429f72511796291ff135c77f10b.tar
dexon-sol-tools-474db7c18de63429f72511796291ff135c77f10b.tar.gz
dexon-sol-tools-474db7c18de63429f72511796291ff135c77f10b.tar.bz2
dexon-sol-tools-474db7c18de63429f72511796291ff135c77f10b.tar.lz
dexon-sol-tools-474db7c18de63429f72511796291ff135c77f10b.tar.xz
dexon-sol-tools-474db7c18de63429f72511796291ff135c77f10b.tar.zst
dexon-sol-tools-474db7c18de63429f72511796291ff135c77f10b.zip
Emulate named parameters with interface
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/heartbeater_factory.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/instant/src/util/heartbeater_factory.ts b/packages/instant/src/util/heartbeater_factory.ts
index beedb66c8..0feb05422 100644
--- a/packages/instant/src/util/heartbeater_factory.ts
+++ b/packages/instant/src/util/heartbeater_factory.ts
@@ -3,14 +3,20 @@ import { Store } from '../redux/store';
import { Heartbeater } from './heartbeater';
-export const generateAccountHeartbeater = (store: Store, performImmediatelyOnStart: boolean): Heartbeater => {
+export interface HeartbeatFactoryOptions {
+ store: Store;
+ performImmediatelyOnStart: boolean;
+}
+export const generateAccountHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => {
+ const { store, performImmediatelyOnStart } = options;
return new Heartbeater(async () => {
await asyncData.fetchAccountInfoAndDispatchToStore(store, { setLoading: false });
}, performImmediatelyOnStart);
};
-export const generateBuyQuoteHeartbeater = (store: Store, performImmediatelyOnStart: boolean): Heartbeater => {
+export const generateBuyQuoteHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => {
+ const { store, performImmediatelyOnStart } = options;
return new Heartbeater(async () => {
- await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(store, false);
+ await asyncData.fetchCurrentBuyQuoteAndDispatchToStore({ store, setPending: false });
}, performImmediatelyOnStart);
};