@openfin/core 45.100.81 → 45.100.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/mock-alpha.d.ts +5 -1
- package/out/mock-beta.d.ts +5 -1
- package/out/mock-public.d.ts +5 -1
- package/out/stub.d.ts +5 -1
- package/out/stub.js +39 -16
- package/out/stub.mjs +39 -16
- package/package.json +1 -1
package/out/mock-alpha.d.ts
CHANGED
|
@@ -2885,7 +2885,7 @@ declare class ChannelProvider extends ChannelBase {
|
|
|
2885
2885
|
* a read-only array containing all the identities of connecting clients.
|
|
2886
2886
|
*/
|
|
2887
2887
|
get connections(): OpenFin_2.ClientConnectionPayload[];
|
|
2888
|
-
static handleClientDisconnection(channel: ChannelProvider, payload:
|
|
2888
|
+
static handleClientDisconnection(channel: ChannelProvider, payload: ClientDisconnectionPayload): void;
|
|
2889
2889
|
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
|
|
2890
2890
|
/* Excluded from this release type: __constructor */
|
|
2891
2891
|
/**
|
|
@@ -3281,6 +3281,10 @@ declare type ClientChangedContextGroup = InteropClientEvent<'client-changed-cont
|
|
|
3281
3281
|
*/
|
|
3282
3282
|
declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
|
|
3283
3283
|
|
|
3284
|
+
declare type ClientDisconnectionPayload = OpenFin_2.Identity & {
|
|
3285
|
+
endpointId?: string;
|
|
3286
|
+
};
|
|
3287
|
+
|
|
3284
3288
|
/**
|
|
3285
3289
|
* Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
|
|
3286
3290
|
* @interface
|
package/out/mock-beta.d.ts
CHANGED
|
@@ -2885,7 +2885,7 @@ declare class ChannelProvider extends ChannelBase {
|
|
|
2885
2885
|
* a read-only array containing all the identities of connecting clients.
|
|
2886
2886
|
*/
|
|
2887
2887
|
get connections(): OpenFin_2.ClientConnectionPayload[];
|
|
2888
|
-
static handleClientDisconnection(channel: ChannelProvider, payload:
|
|
2888
|
+
static handleClientDisconnection(channel: ChannelProvider, payload: ClientDisconnectionPayload): void;
|
|
2889
2889
|
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
|
|
2890
2890
|
/* Excluded from this release type: __constructor */
|
|
2891
2891
|
/**
|
|
@@ -3281,6 +3281,10 @@ declare type ClientChangedContextGroup = InteropClientEvent<'client-changed-cont
|
|
|
3281
3281
|
*/
|
|
3282
3282
|
declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
|
|
3283
3283
|
|
|
3284
|
+
declare type ClientDisconnectionPayload = OpenFin_2.Identity & {
|
|
3285
|
+
endpointId?: string;
|
|
3286
|
+
};
|
|
3287
|
+
|
|
3284
3288
|
/**
|
|
3285
3289
|
* Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
|
|
3286
3290
|
* @interface
|
package/out/mock-public.d.ts
CHANGED
|
@@ -2885,7 +2885,7 @@ declare class ChannelProvider extends ChannelBase {
|
|
|
2885
2885
|
* a read-only array containing all the identities of connecting clients.
|
|
2886
2886
|
*/
|
|
2887
2887
|
get connections(): OpenFin_2.ClientConnectionPayload[];
|
|
2888
|
-
static handleClientDisconnection(channel: ChannelProvider, payload:
|
|
2888
|
+
static handleClientDisconnection(channel: ChannelProvider, payload: ClientDisconnectionPayload): void;
|
|
2889
2889
|
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
|
|
2890
2890
|
/* Excluded from this release type: __constructor */
|
|
2891
2891
|
/**
|
|
@@ -3281,6 +3281,10 @@ declare type ClientChangedContextGroup = InteropClientEvent<'client-changed-cont
|
|
|
3281
3281
|
*/
|
|
3282
3282
|
declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
|
|
3283
3283
|
|
|
3284
|
+
declare type ClientDisconnectionPayload = OpenFin_2.Identity & {
|
|
3285
|
+
endpointId?: string;
|
|
3286
|
+
};
|
|
3287
|
+
|
|
3284
3288
|
/**
|
|
3285
3289
|
* Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
|
|
3286
3290
|
* @interface
|
package/out/stub.d.ts
CHANGED
|
@@ -2938,7 +2938,7 @@ declare class ChannelProvider extends ChannelBase {
|
|
|
2938
2938
|
* a read-only array containing all the identities of connecting clients.
|
|
2939
2939
|
*/
|
|
2940
2940
|
get connections(): OpenFin_2.ClientConnectionPayload[];
|
|
2941
|
-
static handleClientDisconnection(channel: ChannelProvider, payload:
|
|
2941
|
+
static handleClientDisconnection(channel: ChannelProvider, payload: ClientDisconnectionPayload): void;
|
|
2942
2942
|
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
|
|
2943
2943
|
/**
|
|
2944
2944
|
* @internal
|
|
@@ -3337,6 +3337,10 @@ declare type ClientChangedContextGroup = InteropClientEvent<'client-changed-cont
|
|
|
3337
3337
|
*/
|
|
3338
3338
|
declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
|
|
3339
3339
|
|
|
3340
|
+
declare type ClientDisconnectionPayload = OpenFin_2.Identity & {
|
|
3341
|
+
endpointId?: string;
|
|
3342
|
+
};
|
|
3343
|
+
|
|
3340
3344
|
/**
|
|
3341
3345
|
* Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
|
|
3342
3346
|
* @interface
|
package/out/stub.js
CHANGED
|
@@ -8314,9 +8314,8 @@ class ChannelProvider extends ChannelBase {
|
|
|
8314
8314
|
return [...__classPrivateFieldGet$g(this, _ChannelProvider_connections, "f")];
|
|
8315
8315
|
}
|
|
8316
8316
|
static handleClientDisconnection(channel, payload) {
|
|
8317
|
-
if (payload
|
|
8318
|
-
|
|
8319
|
-
__classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
8317
|
+
if (payload.endpointId) {
|
|
8318
|
+
__classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
|
|
8320
8319
|
}
|
|
8321
8320
|
else {
|
|
8322
8321
|
// this is here to support older runtimes that did not have endpointId
|
|
@@ -8486,7 +8485,9 @@ class ChannelProvider extends ChannelBase {
|
|
|
8486
8485
|
* ```
|
|
8487
8486
|
*/
|
|
8488
8487
|
onDisconnection(listener) {
|
|
8489
|
-
this.disconnectListener =
|
|
8488
|
+
this.disconnectListener = (identity) => {
|
|
8489
|
+
listener(identity);
|
|
8490
|
+
};
|
|
8490
8491
|
}
|
|
8491
8492
|
/**
|
|
8492
8493
|
* Destroy the channel, raises `disconnected` events on all connected channel clients.
|
|
@@ -8503,7 +8504,6 @@ class ChannelProvider extends ChannelBase {
|
|
|
8503
8504
|
*/
|
|
8504
8505
|
async destroy() {
|
|
8505
8506
|
const protectedObj = __classPrivateFieldGet$g(this, _ChannelProvider_protectedObj, "f");
|
|
8506
|
-
protectedObj.providerIdentity;
|
|
8507
8507
|
__classPrivateFieldSet$f(this, _ChannelProvider_connections, [], "f");
|
|
8508
8508
|
await protectedObj.close();
|
|
8509
8509
|
__classPrivateFieldGet$g(this, _ChannelProvider_close, "f").call(this);
|
|
@@ -8800,6 +8800,13 @@ class ConnectionManager extends Base {
|
|
|
8800
8800
|
_ConnectionManager_messageReceiver.set(this, void 0);
|
|
8801
8801
|
_ConnectionManager_rtcConnectionManager.set(this, void 0);
|
|
8802
8802
|
this.removeChannelFromProviderMap = (channelId) => {
|
|
8803
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8804
|
+
if (providerEntry) {
|
|
8805
|
+
const { channelName } = providerEntry.providerIdentity;
|
|
8806
|
+
if (this.providerChannelIdByName.get(channelName) === channelId) {
|
|
8807
|
+
this.providerChannelIdByName.delete(channelName);
|
|
8808
|
+
}
|
|
8809
|
+
}
|
|
8803
8810
|
this.providerMap.delete(channelId);
|
|
8804
8811
|
};
|
|
8805
8812
|
this.onmessage = (msg) => {
|
|
@@ -8810,6 +8817,7 @@ class ConnectionManager extends Base {
|
|
|
8810
8817
|
return false;
|
|
8811
8818
|
};
|
|
8812
8819
|
this.providerMap = new Map();
|
|
8820
|
+
this.providerChannelIdByName = new Map();
|
|
8813
8821
|
this.protocolManager = new ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
8814
8822
|
__classPrivateFieldSet$e(this, _ConnectionManager_messageReceiver, new MessageReceiver(wire), "f");
|
|
8815
8823
|
__classPrivateFieldSet$e(this, _ConnectionManager_rtcConnectionManager, new RTCICEManager(wire), "f");
|
|
@@ -8846,10 +8854,12 @@ class ConnectionManager extends Base {
|
|
|
8846
8854
|
const channel = new ChannelProvider(providerIdentity, () => ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
|
|
8847
8855
|
const key = providerIdentity.channelId;
|
|
8848
8856
|
this.providerMap.set(key, {
|
|
8857
|
+
providerIdentity,
|
|
8849
8858
|
provider: channel,
|
|
8850
8859
|
strategy,
|
|
8851
8860
|
supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
|
|
8852
8861
|
});
|
|
8862
|
+
this.providerChannelIdByName.set(providerIdentity.channelName, key);
|
|
8853
8863
|
ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
|
|
8854
8864
|
return channel;
|
|
8855
8865
|
}
|
|
@@ -8924,6 +8934,16 @@ class ConnectionManager extends Base {
|
|
|
8924
8934
|
strategy.addEndpoint(routingInfo.channelId, endpointPayload);
|
|
8925
8935
|
return strategy;
|
|
8926
8936
|
}
|
|
8937
|
+
handleClientDisconnection(eventPayload) {
|
|
8938
|
+
const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
|
|
8939
|
+
if (!channelId) {
|
|
8940
|
+
return;
|
|
8941
|
+
}
|
|
8942
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8943
|
+
if (providerEntry) {
|
|
8944
|
+
ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
|
|
8945
|
+
}
|
|
8946
|
+
}
|
|
8927
8947
|
async processChannelConnection(msg) {
|
|
8928
8948
|
const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
|
|
8929
8949
|
if (!clientIdentity.endpointId) {
|
|
@@ -9023,7 +9043,7 @@ var __classPrivateFieldGet$e = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
9023
9043
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
9024
9044
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9025
9045
|
};
|
|
9026
|
-
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
|
|
9046
|
+
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
|
|
9027
9047
|
function retryDelay(count) {
|
|
9028
9048
|
const interval = 500; // base delay
|
|
9029
9049
|
const steps = 10; // How many retries to do before incrementing the delay
|
|
@@ -9059,9 +9079,19 @@ class Channel extends EmitterBase {
|
|
|
9059
9079
|
super(wire, 'channel');
|
|
9060
9080
|
_Channel_connectionManager.set(this, void 0);
|
|
9061
9081
|
_Channel_internalEmitter.set(this, new events.EventEmitter());
|
|
9082
|
+
// Provider-side disconnect routing setup. This must exist before first create()
|
|
9083
|
+
// so provider onDisconnection callbacks are wired even if connect() is never called.
|
|
9084
|
+
_Channel_readyForProvider.set(this, new AsyncRetryableLazy(async () => {
|
|
9085
|
+
// TODO: fix typing (internal)
|
|
9086
|
+
// @ts-expect-error
|
|
9087
|
+
await this.on('client-disconnected', (eventPayload) => {
|
|
9088
|
+
__classPrivateFieldGet$e(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
|
|
9089
|
+
});
|
|
9090
|
+
}));
|
|
9062
9091
|
// OpenFin API has not been injected at construction time, *must* wait for API to be ready.
|
|
9063
9092
|
_Channel_readyToConnect.set(this, new AsyncRetryableLazy(async () => {
|
|
9064
9093
|
await Promise.all([
|
|
9094
|
+
__classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue(),
|
|
9065
9095
|
this.on('disconnected', (eventPayload) => {
|
|
9066
9096
|
ChannelClient.handleProviderDisconnect(eventPayload);
|
|
9067
9097
|
}),
|
|
@@ -9318,22 +9348,15 @@ class Channel extends EmitterBase {
|
|
|
9318
9348
|
* ```
|
|
9319
9349
|
*/
|
|
9320
9350
|
async create(channelName, options) {
|
|
9351
|
+
await __classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue();
|
|
9321
9352
|
if (!channelName) {
|
|
9322
9353
|
throw new Error('Please provide a channelName to create a channel');
|
|
9323
9354
|
}
|
|
9324
9355
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
9325
|
-
|
|
9326
|
-
// TODO: fix typing (internal)
|
|
9327
|
-
// @ts-expect-error
|
|
9328
|
-
this.on('client-disconnected', (eventPayload) => {
|
|
9329
|
-
if (eventPayload.channelName === channelName) {
|
|
9330
|
-
ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
9331
|
-
}
|
|
9332
|
-
});
|
|
9333
|
-
return channel;
|
|
9356
|
+
return __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
9334
9357
|
}
|
|
9335
9358
|
}
|
|
9336
|
-
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9359
|
+
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9337
9360
|
|
|
9338
9361
|
/**
|
|
9339
9362
|
* Entry point for the OpenFin `InterApplicationBus` API (`fin.InterApplicationBus`).
|
package/out/stub.mjs
CHANGED
|
@@ -8310,9 +8310,8 @@ class ChannelProvider extends ChannelBase {
|
|
|
8310
8310
|
return [...__classPrivateFieldGet$g(this, _ChannelProvider_connections, "f")];
|
|
8311
8311
|
}
|
|
8312
8312
|
static handleClientDisconnection(channel, payload) {
|
|
8313
|
-
if (payload
|
|
8314
|
-
|
|
8315
|
-
__classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
8313
|
+
if (payload.endpointId) {
|
|
8314
|
+
__classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
|
|
8316
8315
|
}
|
|
8317
8316
|
else {
|
|
8318
8317
|
// this is here to support older runtimes that did not have endpointId
|
|
@@ -8482,7 +8481,9 @@ class ChannelProvider extends ChannelBase {
|
|
|
8482
8481
|
* ```
|
|
8483
8482
|
*/
|
|
8484
8483
|
onDisconnection(listener) {
|
|
8485
|
-
this.disconnectListener =
|
|
8484
|
+
this.disconnectListener = (identity) => {
|
|
8485
|
+
listener(identity);
|
|
8486
|
+
};
|
|
8486
8487
|
}
|
|
8487
8488
|
/**
|
|
8488
8489
|
* Destroy the channel, raises `disconnected` events on all connected channel clients.
|
|
@@ -8499,7 +8500,6 @@ class ChannelProvider extends ChannelBase {
|
|
|
8499
8500
|
*/
|
|
8500
8501
|
async destroy() {
|
|
8501
8502
|
const protectedObj = __classPrivateFieldGet$g(this, _ChannelProvider_protectedObj, "f");
|
|
8502
|
-
protectedObj.providerIdentity;
|
|
8503
8503
|
__classPrivateFieldSet$f(this, _ChannelProvider_connections, [], "f");
|
|
8504
8504
|
await protectedObj.close();
|
|
8505
8505
|
__classPrivateFieldGet$g(this, _ChannelProvider_close, "f").call(this);
|
|
@@ -8796,6 +8796,13 @@ class ConnectionManager extends Base {
|
|
|
8796
8796
|
_ConnectionManager_messageReceiver.set(this, void 0);
|
|
8797
8797
|
_ConnectionManager_rtcConnectionManager.set(this, void 0);
|
|
8798
8798
|
this.removeChannelFromProviderMap = (channelId) => {
|
|
8799
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8800
|
+
if (providerEntry) {
|
|
8801
|
+
const { channelName } = providerEntry.providerIdentity;
|
|
8802
|
+
if (this.providerChannelIdByName.get(channelName) === channelId) {
|
|
8803
|
+
this.providerChannelIdByName.delete(channelName);
|
|
8804
|
+
}
|
|
8805
|
+
}
|
|
8799
8806
|
this.providerMap.delete(channelId);
|
|
8800
8807
|
};
|
|
8801
8808
|
this.onmessage = (msg) => {
|
|
@@ -8806,6 +8813,7 @@ class ConnectionManager extends Base {
|
|
|
8806
8813
|
return false;
|
|
8807
8814
|
};
|
|
8808
8815
|
this.providerMap = new Map();
|
|
8816
|
+
this.providerChannelIdByName = new Map();
|
|
8809
8817
|
this.protocolManager = new ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
8810
8818
|
__classPrivateFieldSet$e(this, _ConnectionManager_messageReceiver, new MessageReceiver(wire), "f");
|
|
8811
8819
|
__classPrivateFieldSet$e(this, _ConnectionManager_rtcConnectionManager, new RTCICEManager(wire), "f");
|
|
@@ -8842,10 +8850,12 @@ class ConnectionManager extends Base {
|
|
|
8842
8850
|
const channel = new ChannelProvider(providerIdentity, () => ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
|
|
8843
8851
|
const key = providerIdentity.channelId;
|
|
8844
8852
|
this.providerMap.set(key, {
|
|
8853
|
+
providerIdentity,
|
|
8845
8854
|
provider: channel,
|
|
8846
8855
|
strategy,
|
|
8847
8856
|
supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
|
|
8848
8857
|
});
|
|
8858
|
+
this.providerChannelIdByName.set(providerIdentity.channelName, key);
|
|
8849
8859
|
ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
|
|
8850
8860
|
return channel;
|
|
8851
8861
|
}
|
|
@@ -8920,6 +8930,16 @@ class ConnectionManager extends Base {
|
|
|
8920
8930
|
strategy.addEndpoint(routingInfo.channelId, endpointPayload);
|
|
8921
8931
|
return strategy;
|
|
8922
8932
|
}
|
|
8933
|
+
handleClientDisconnection(eventPayload) {
|
|
8934
|
+
const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
|
|
8935
|
+
if (!channelId) {
|
|
8936
|
+
return;
|
|
8937
|
+
}
|
|
8938
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8939
|
+
if (providerEntry) {
|
|
8940
|
+
ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
|
|
8941
|
+
}
|
|
8942
|
+
}
|
|
8923
8943
|
async processChannelConnection(msg) {
|
|
8924
8944
|
const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
|
|
8925
8945
|
if (!clientIdentity.endpointId) {
|
|
@@ -9019,7 +9039,7 @@ var __classPrivateFieldGet$e = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
9019
9039
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
9020
9040
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9021
9041
|
};
|
|
9022
|
-
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
|
|
9042
|
+
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
|
|
9023
9043
|
function retryDelay(count) {
|
|
9024
9044
|
const interval = 500; // base delay
|
|
9025
9045
|
const steps = 10; // How many retries to do before incrementing the delay
|
|
@@ -9055,9 +9075,19 @@ class Channel extends EmitterBase {
|
|
|
9055
9075
|
super(wire, 'channel');
|
|
9056
9076
|
_Channel_connectionManager.set(this, void 0);
|
|
9057
9077
|
_Channel_internalEmitter.set(this, new EventEmitter());
|
|
9078
|
+
// Provider-side disconnect routing setup. This must exist before first create()
|
|
9079
|
+
// so provider onDisconnection callbacks are wired even if connect() is never called.
|
|
9080
|
+
_Channel_readyForProvider.set(this, new AsyncRetryableLazy(async () => {
|
|
9081
|
+
// TODO: fix typing (internal)
|
|
9082
|
+
// @ts-expect-error
|
|
9083
|
+
await this.on('client-disconnected', (eventPayload) => {
|
|
9084
|
+
__classPrivateFieldGet$e(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
|
|
9085
|
+
});
|
|
9086
|
+
}));
|
|
9058
9087
|
// OpenFin API has not been injected at construction time, *must* wait for API to be ready.
|
|
9059
9088
|
_Channel_readyToConnect.set(this, new AsyncRetryableLazy(async () => {
|
|
9060
9089
|
await Promise.all([
|
|
9090
|
+
__classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue(),
|
|
9061
9091
|
this.on('disconnected', (eventPayload) => {
|
|
9062
9092
|
ChannelClient.handleProviderDisconnect(eventPayload);
|
|
9063
9093
|
}),
|
|
@@ -9314,22 +9344,15 @@ class Channel extends EmitterBase {
|
|
|
9314
9344
|
* ```
|
|
9315
9345
|
*/
|
|
9316
9346
|
async create(channelName, options) {
|
|
9347
|
+
await __classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue();
|
|
9317
9348
|
if (!channelName) {
|
|
9318
9349
|
throw new Error('Please provide a channelName to create a channel');
|
|
9319
9350
|
}
|
|
9320
9351
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
9321
|
-
|
|
9322
|
-
// TODO: fix typing (internal)
|
|
9323
|
-
// @ts-expect-error
|
|
9324
|
-
this.on('client-disconnected', (eventPayload) => {
|
|
9325
|
-
if (eventPayload.channelName === channelName) {
|
|
9326
|
-
ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
9327
|
-
}
|
|
9328
|
-
});
|
|
9329
|
-
return channel;
|
|
9352
|
+
return __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
9330
9353
|
}
|
|
9331
9354
|
}
|
|
9332
|
-
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9355
|
+
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9333
9356
|
|
|
9334
9357
|
/**
|
|
9335
9358
|
* Entry point for the OpenFin `InterApplicationBus` API (`fin.InterApplicationBus`).
|