diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-10 03:22:46 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-10 03:22:46 +0800 |
commit | 474db7c18de63429f72511796291ff135c77f10b (patch) | |
tree | 63eee7214fafd8d69cb982036906a6c1e651b7d7 /packages/instant/src/util/heartbeater_factory.ts | |
parent | 39657b633bd386526f5772238cbebfb976427c07 (diff) | |
download | dexon-0x-contracts-474db7c18de63429f72511796291ff135c77f10b.tar.gz dexon-0x-contracts-474db7c18de63429f72511796291ff135c77f10b.tar.zst dexon-0x-contracts-474db7c18de63429f72511796291ff135c77f10b.zip |
Emulate named parameters with interface
Diffstat (limited to 'packages/instant/src/util/heartbeater_factory.ts')
-rw-r--r-- | packages/instant/src/util/heartbeater_factory.ts | 12 |
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); }; |