From 37a2841712391ce8309b86f736e8a050d3425b30 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Wed, 23 Aug 2023 14:38:02 -0300 Subject: [PATCH] Extract type of IPlatform.Transports Preparation for #1394 (making transports tree-shakable). --- src/common/lib/transport/connectionmanager.ts | 2 ++ src/common/platform.ts | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/lib/transport/connectionmanager.ts b/src/common/lib/transport/connectionmanager.ts index 0c9c3f15b0..0a7fc38c72 100644 --- a/src/common/lib/transport/connectionmanager.ts +++ b/src/common/lib/transport/connectionmanager.ts @@ -2167,3 +2167,5 @@ class ConnectionManager extends EventEmitter { } export default ConnectionManager; + +export type TransportInitialiser = (connectionManager: typeof ConnectionManager) => typeof Transport; diff --git a/src/common/platform.ts b/src/common/platform.ts index b276c1cbd9..aa8e133019 100644 --- a/src/common/platform.ts +++ b/src/common/platform.ts @@ -1,10 +1,9 @@ import { IPlatformConfig } from './types/IPlatformConfig'; import { IHttp } from './types/http'; -import ConnectionManager from './lib/transport/connectionmanager'; +import { TransportInitialiser } from './lib/transport/connectionmanager'; import IDefaults from './types/IDefaults'; import IWebStorage from './types/IWebStorage'; import IBufferUtils from './types/IBufferUtils'; -import Transport from './lib/transport/transport'; import * as WebBufferUtils from '../platform/web/lib/util/bufferutils'; import * as NodeBufferUtils from '../platform/nodejs/lib/util/bufferutils'; import { IUntypedCryptoStatic } from '../common/types/ICryptoStatic'; @@ -30,7 +29,7 @@ export default class Platform { */ static Crypto: IUntypedCryptoStatic | null; static Http: typeof IHttp; - static Transports: Array<(connectionManager: typeof ConnectionManager) => typeof Transport>; + static Transports: TransportInitialiser[]; static Defaults: IDefaults; static WebStorage: IWebStorage | null; }