From fa54f572be55d12cd558b122185327c4e67e79c2 Mon Sep 17 00:00:00 2001 From: dperolio Date: Tue, 1 Mar 2022 18:03:06 -0500 Subject: [PATCH] remove connections api --- renderer/src/api/Connections.js | 54 --------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 renderer/src/api/Connections.js diff --git a/renderer/src/api/Connections.js b/renderer/src/api/Connections.js deleted file mode 100644 index 08b7e11f..00000000 --- a/renderer/src/api/Connections.js +++ /dev/null @@ -1,54 +0,0 @@ -import { API } from '@vizality/entities'; - -export default class Connections extends API { - constructor () { - super(); - this.connections = []; - this._module = 'API'; - this._submodule = 'Connections'; - } - - get filter () { - return this.connections.filter.bind(this.connections); - } - - stop () { - this.removeAllListeners(); - delete vizality.api.connections; - } - - get map () { - return this.connections.map.bind(this.connections); - } - - get filter () { - return this.connections.filter.bind(this.connections); - } - - registerConnection (connection) { - if (this.get(connection.type)) { - /* @todo: Use logger. */ - throw new Error('This type of connection already exists!'); - } - this.connections.push(connection); - } - - unregisterConnection (type) { - this.connections = this.connections.filter(c => c.type !== type); - } - - fetchAccounts (id) { - return Promise.all( - this.filter(c => c.enabled).map(c => c.fetchAccount(id)) - ); - } - - get (type) { - const connections = {}; - for (const element of this.connections) { - connections[element.type] = element; - } - - return connections[type] || null; - } -}