diff options
author | Jacob Evans <jacob@dekz.net> | 2017-11-12 00:01:59 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2017-11-12 00:01:59 +0800 |
commit | 4ae9482d506ccdf028fcd39bbaf652bbcbef52e8 (patch) | |
tree | 3b133b11e8074a75ceafe006b6166a41022a634a /src/contract_wrappers/contract_wrapper.ts | |
parent | 4262ac3c8966468b343c6467e0e9da85ef25be05 (diff) | |
download | dexon-sol-tools-4ae9482d506ccdf028fcd39bbaf652bbcbef52e8.tar dexon-sol-tools-4ae9482d506ccdf028fcd39bbaf652bbcbef52e8.tar.gz dexon-sol-tools-4ae9482d506ccdf028fcd39bbaf652bbcbef52e8.tar.bz2 dexon-sol-tools-4ae9482d506ccdf028fcd39bbaf652bbcbef52e8.tar.lz dexon-sol-tools-4ae9482d506ccdf028fcd39bbaf652bbcbef52e8.tar.xz dexon-sol-tools-4ae9482d506ccdf028fcd39bbaf652bbcbef52e8.tar.zst dexon-sol-tools-4ae9482d506ccdf028fcd39bbaf652bbcbef52e8.zip |
Clean up subscription state.
In the case of an exception, keep the state correct between contract wrapper, exchange wrapper and token wrapper.
Diffstat (limited to 'src/contract_wrappers/contract_wrapper.ts')
-rw-r--r-- | src/contract_wrappers/contract_wrapper.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts index a02465982..5bdc66b3b 100644 --- a/src/contract_wrappers/contract_wrapper.ts +++ b/src/contract_wrappers/contract_wrapper.ts @@ -50,6 +50,12 @@ export class ContractWrapper { this._filterCallbacks[filterToken] = callback; return filterToken; } + protected unsubscribeAll(): void { + const filterTokens = _.keys(this._filterCallbacks); + _.each(filterTokens, filterToken => { + this._unsubscribe(filterToken); + }); + } protected _unsubscribe(filterToken: string, err?: Error): void { if (_.isUndefined(this._filters[filterToken])) { throw new Error(ZeroExError.SubscriptionNotFound); |