Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public stop(): void {
if (this._queueIntervalIdIfExists !== undefined) {
intervalUtils.clearAsyncExcludingInterval(this._queueIntervalIdIfExists);
}
}
private _start(): void {
private _stopBlockAndLogStream(): void {
if (_.isUndefined(this._blockAndLogStreamerIfExists)) {
throw new Error(OrderWatcherError.SubscriptionNotFound);
}
this._blockAndLogStreamerIfExists.unsubscribeFromOnLogAdded(this._onLogAddedSubscriptionToken as string);
this._blockAndLogStreamerIfExists.unsubscribeFromOnLogRemoved(this._onLogRemovedSubscriptionToken as string);
intervalUtils.clearAsyncExcludingInterval(this._blockAndLogStreamIntervalIfExists as NodeJS.Timer);
delete this._blockAndLogStreamerIfExists;
delete this._blockAndLogStreamIntervalIfExists;
}
private async _onLogStateChangedAsync(
public unsubscribe(): void {
if (this._callbackIfExists === undefined || this._cleanupJobIntervalIdIfExists === undefined) {
throw new Error(OrderWatcherError.SubscriptionNotFound);
}
this._balanceAndProxyAllowanceLazyStore.deleteAll();
this._orderFilledCancelledLazyStore.deleteAll();
delete this._callbackIfExists;
this._eventWatcher.unsubscribe();
this._expirationWatcher.unsubscribe();
intervalUtils.clearAsyncExcludingInterval(this._cleanupJobIntervalIdIfExists);
}
/**
(err: Error) => {
intervalUtils.clearAsyncExcludingInterval(intervalId);
reject(err);
},
);
private _stopEmittingUserBalanceState(): void {
if (this._watchBalanceIntervalId !== undefined) {
intervalUtils.clearAsyncExcludingInterval(this._watchBalanceIntervalId);
}
}
}
private _stopWatchingGasPrice(): void {
if (!_.isUndefined(this._watchGasPriceIntervalId)) {
intervalUtils.clearAsyncExcludingInterval(this._watchGasPriceIntervalId);
}
}
private async _resetOrInitializeAsync(