UNPKG

@polkadot/api-provider

Version:
22 lines (18 loc) 635 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = unsubscribe; // Copyright 2017-2018 @polkadot/api-provider authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. async function unsubscribe(self, type, name, id) { const method = self.subscriptionMap[id]; self.l.debug(() => ['unsubscribe', id, method]); if (!method) { throw new Error(`Unable to find subscription for ${id}`); } delete self.subscriptionMap[id]; delete self.subscriptions[method].callbacks[id]; return true; }