UNPKG

613 BJavaScriptView Raw
1"use strict";
2
3// Copyright 2017-2018 Jaco Greeff
4// This software may be modified and distributed under the terms
5// of the ISC license. See the LICENSE file for details.
6const assert = require('@polkadot/util/assert');
7
8const isUndefined = require('@polkadot/util/is/undefined');
9
10const send = require('./send');
11
12module.exports = async function unsubscribe(self, method, id) {
13 assert(!isUndefined(self.subscriptions[id]), `Unable to find active subscription=${id}`);
14 delete self.subscriptions[id];
15 const result = await send(self, method, [id]); // flowlint-next-line unclear-type:off
16
17 return result;
18};
\No newline at end of file