1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = unsubscribe;
|
7 |
|
8 | // Copyright 2017-2018 @polkadot/api-provider authors & contributors
|
9 | // This software may be modified and distributed under the terms
|
10 | // of the ISC license. See the LICENSE file for details.
|
11 | async function unsubscribe(self, type, name, id) {
|
12 | const method = self.subscriptionMap[id];
|
13 | self.l.debug(() => ['unsubscribe', id, method]);
|
14 |
|
15 | if (!method) {
|
16 | throw new Error(`Unable to find subscription for ${id}`);
|
17 | }
|
18 |
|
19 | delete self.subscriptionMap[id];
|
20 | delete self.subscriptions[method].callbacks[id];
|
21 | return true;
|
22 | } |
\ | No newline at end of file |