aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/order_watcher/expiration_watcher.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-12-22 22:05:32 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-03 18:37:38 +0800
commite744e4cd989bd3ae1070c59f7baa8097f18b8b06 (patch)
treea7fde03873f3c1b8689d3991edbb362f8022e5f0 /packages/0x.js/src/order_watcher/expiration_watcher.ts
parent9a96e8c704b6f84e00bbe848159a4819844cf09d (diff)
downloaddexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.gz
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.bz2
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.lz
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.xz
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.zst
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.zip
Apply prettier config
Diffstat (limited to 'packages/0x.js/src/order_watcher/expiration_watcher.ts')
-rw-r--r--packages/0x.js/src/order_watcher/expiration_watcher.ts25
1 files changed, 12 insertions, 13 deletions
diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/0x.js/src/order_watcher/expiration_watcher.ts
index e71f11129..47e03dd38 100644
--- a/packages/0x.js/src/order_watcher/expiration_watcher.ts
+++ b/packages/0x.js/src/order_watcher/expiration_watcher.ts
@@ -1,10 +1,10 @@
-import {intervalUtils} from '@0xproject/utils';
-import {BigNumber} from 'bignumber.js';
-import {RBTree} from 'bintrees';
+import { intervalUtils } from '@0xproject/utils';
+import { BigNumber } from 'bignumber.js';
+import { RBTree } from 'bintrees';
import * as _ from 'lodash';
-import {ZeroExError} from '../types';
-import {utils} from '../utils/utils';
+import { ZeroExError } from '../types';
+import { utils } from '../utils/utils';
const DEFAULT_EXPIRATION_MARGIN_MS = 0;
const DEFAULT_ORDER_EXPIRATION_CHECKING_INTERVAL_MS = 50;
@@ -15,16 +15,14 @@ const DEFAULT_ORDER_EXPIRATION_CHECKING_INTERVAL_MS = 50;
*/
export class ExpirationWatcher {
private _orderHashByExpirationRBTree: RBTree<string>;
- private _expiration: {[orderHash: string]: BigNumber} = {};
+ private _expiration: { [orderHash: string]: BigNumber } = {};
private _orderExpirationCheckingIntervalMs: number;
private _expirationMarginMs: number;
private _orderExpirationCheckingIntervalIdIfExists?: NodeJS.Timer;
- constructor(expirationMarginIfExistsMs?: number,
- orderExpirationCheckingIntervalIfExistsMs?: number) {
- this._expirationMarginMs = expirationMarginIfExistsMs ||
- DEFAULT_EXPIRATION_MARGIN_MS;
- this._orderExpirationCheckingIntervalMs = expirationMarginIfExistsMs ||
- DEFAULT_ORDER_EXPIRATION_CHECKING_INTERVAL_MS;
+ constructor(expirationMarginIfExistsMs?: number, orderExpirationCheckingIntervalIfExistsMs?: number) {
+ this._expirationMarginMs = expirationMarginIfExistsMs || DEFAULT_EXPIRATION_MARGIN_MS;
+ this._orderExpirationCheckingIntervalMs =
+ expirationMarginIfExistsMs || DEFAULT_ORDER_EXPIRATION_CHECKING_INTERVAL_MS;
const scoreFunction = (orderHash: string) => this._expiration[orderHash].toNumber();
const comparator = (lhs: string, rhs: string) => scoreFunction(lhs) - scoreFunction(rhs);
this._orderHashByExpirationRBTree = new RBTree(comparator);
@@ -34,7 +32,8 @@ export class ExpirationWatcher {
throw new Error(ZeroExError.SubscriptionAlreadyPresent);
}
this._orderExpirationCheckingIntervalIdIfExists = intervalUtils.setAsyncExcludingInterval(
- this._pruneExpiredOrders.bind(this, callback), this._orderExpirationCheckingIntervalMs,
+ this._pruneExpiredOrders.bind(this, callback),
+ this._orderExpirationCheckingIntervalMs,
);
}
public unsubscribe(): void {