@interopio/fdc3 2.0.1 → 2.0.3
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/changelog.md +5 -1
- package/dist/fdc3.electron.es.js +3125 -0
- package/dist/fdc3.electron.umd.js +3133 -0
- package/dist/fdc3.es.js +29 -80
- package/dist/fdc3.umd.js +29 -80
- package/package.json +4 -3
package/dist/fdc3.es.js
CHANGED
|
@@ -71,17 +71,6 @@ const AsyncListener = (actualUnsub) => {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
const checkIfInElectron = (globalFdc3) => {
|
|
75
|
-
const hasGlue42electron = typeof window !== "undefined" && "glue42electron" in window;
|
|
76
|
-
if (!hasGlue42electron) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const runningInElectron = typeof process !== "undefined" && "contextIsolated" in process;
|
|
80
|
-
if (runningInElectron) {
|
|
81
|
-
const contextBridge = require("electron").contextBridge;
|
|
82
|
-
contextBridge.exposeInMainWorld("fdc3", globalFdc3);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
74
|
const promisePlus = (promise, timeoutMilliseconds, timeoutMessage) => {
|
|
86
75
|
return new Promise((resolve, reject) => {
|
|
87
76
|
const timeout = setTimeout(() => {
|
|
@@ -1982,7 +1971,7 @@ class IntentsController {
|
|
|
1982
1971
|
}
|
|
1983
1972
|
}
|
|
1984
1973
|
|
|
1985
|
-
var version = "2.0.
|
|
1974
|
+
var version = "2.0.3";
|
|
1986
1975
|
|
|
1987
1976
|
class ApplicationsController {
|
|
1988
1977
|
constructor(glueController) {
|
|
@@ -2192,13 +2181,12 @@ class ApplicationsController {
|
|
|
2192
2181
|
}
|
|
2193
2182
|
|
|
2194
2183
|
class ChannelsController {
|
|
2195
|
-
constructor(glueController, channelsStateStore, channelsParser, channelsFactory, channelsCallbackRegistry
|
|
2184
|
+
constructor(glueController, channelsStateStore, channelsParser, channelsFactory, channelsCallbackRegistry) {
|
|
2196
2185
|
this.glueController = glueController;
|
|
2197
2186
|
this.channelsStateStore = channelsStateStore;
|
|
2198
2187
|
this.channelsParser = channelsParser;
|
|
2199
2188
|
this.channelsFactory = channelsFactory;
|
|
2200
2189
|
this.channelsCallbackRegistry = channelsCallbackRegistry;
|
|
2201
|
-
this.channelsPendingListenersStore = channelsPendingListenersStore;
|
|
2202
2190
|
this.invokeContextHandlerWithStartupContext = true;
|
|
2203
2191
|
this.initDonePromise = this.initialize();
|
|
2204
2192
|
this.initDonePromise.catch(() => { });
|
|
@@ -2219,7 +2207,7 @@ class ChannelsController {
|
|
|
2219
2207
|
this.handleWindowContextOnOpening(commandId, handler, contextType).catch((err) => this.logger.warn(`[${commandId}] - ${err}`));
|
|
2220
2208
|
}
|
|
2221
2209
|
const channelIdToSubscribeTo = channelId || ((_a = this.channelsStateStore.currentChannel) === null || _a === void 0 ? void 0 : _a.id);
|
|
2222
|
-
return this.addContextListenerByChannelId(commandId, handler, channelIdToSubscribeTo, contextType);
|
|
2210
|
+
return this.addContextListenerByChannelId({ commandId, handler, invokedOnChannelModel: !!channelId, channelId: channelIdToSubscribeTo, contextType });
|
|
2223
2211
|
});
|
|
2224
2212
|
}
|
|
2225
2213
|
broadcast(commandId, context, channelId) {
|
|
@@ -2292,7 +2280,6 @@ class ChannelsController {
|
|
|
2292
2280
|
yield this.glueController.leaveChannel();
|
|
2293
2281
|
this.channelsStateStore.currentChannel = null;
|
|
2294
2282
|
this.logger.info(`[${commandId}] - current channel is left. unsubscribing from all listeners`);
|
|
2295
|
-
this.channelsPendingListenersStore.unsubscribePendingListeners();
|
|
2296
2283
|
});
|
|
2297
2284
|
}
|
|
2298
2285
|
getContextForChannel({ commandId, channelId, contextType }) {
|
|
@@ -2407,13 +2394,10 @@ class ChannelsController {
|
|
|
2407
2394
|
handleOnChannelChanged(channelId) {
|
|
2408
2395
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2409
2396
|
if (!channelId) {
|
|
2410
|
-
this.channelsPendingListenersStore.unsubscribePendingListeners();
|
|
2411
2397
|
return;
|
|
2412
2398
|
}
|
|
2413
2399
|
const isFdc3ChannelName = fdc3ChannelNames.includes(channelId);
|
|
2414
2400
|
const userChannelId = isFdc3ChannelName ? channelId : this.channelsStateStore.getFdc3ChannelIdByGlueChannelName(channelId);
|
|
2415
|
-
const commandId = nanoid();
|
|
2416
|
-
yield this.channelsPendingListenersStore.subscribePendingListeners(commandId, this.addContextListener.bind(this), userChannelId);
|
|
2417
2401
|
this.channelsStateStore.currentChannel = this.channelsStateStore.userChannels[userChannelId];
|
|
2418
2402
|
});
|
|
2419
2403
|
}
|
|
@@ -2508,23 +2492,17 @@ class ChannelsController {
|
|
|
2508
2492
|
return this.glueController.channelsUpdate(glueChannelName, context);
|
|
2509
2493
|
});
|
|
2510
2494
|
}
|
|
2511
|
-
addContextListenerByChannelId(commandId, handler,
|
|
2495
|
+
addContextListenerByChannelId({ commandId, channelId, handler, contextType, invokedOnChannelModel }) {
|
|
2512
2496
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2513
2497
|
const subHandler = parseContextHandler(handler, contextType);
|
|
2514
2498
|
if (!channelId) {
|
|
2515
|
-
this.logger.info(`[${commandId}] -
|
|
2516
|
-
|
|
2499
|
+
this.logger.info(`[${commandId}] - Creating a channel subscription using glue.channels.subscribe`);
|
|
2500
|
+
const unsubscribe = this.glueController.channelsSubscribe(subHandler);
|
|
2501
|
+
return { unsubscribe };
|
|
2517
2502
|
}
|
|
2518
2503
|
const channelType = this.getChannelTypeById(channelId);
|
|
2519
2504
|
if (channelType === ChannelTypes.User) {
|
|
2520
|
-
this.
|
|
2521
|
-
const unsubscribe = this.glueController.channelsSubscribe(subHandler);
|
|
2522
|
-
return {
|
|
2523
|
-
unsubscribe: () => {
|
|
2524
|
-
this.logger.info(`[${commandId}] - invoking unsubscribe for fdc3 user channel with id ${channelId}`);
|
|
2525
|
-
unsubscribe();
|
|
2526
|
-
}
|
|
2527
|
-
};
|
|
2505
|
+
return this.addContextListenerOnUserChannel({ commandId, channelId, handler: subHandler, contextType, invokedOnChannelModel });
|
|
2528
2506
|
}
|
|
2529
2507
|
if (channelType === ChannelTypes.App) {
|
|
2530
2508
|
this.logger.info(`[${commandId}] - subscribing for fdc3 app channel with id ${channelId} (underlying glue context with same name)`);
|
|
@@ -2554,6 +2532,26 @@ class ChannelsController {
|
|
|
2554
2532
|
throw { message: ChannelError.AccessDenied, reason: "Cannot add a context listener on an invalid channel" };
|
|
2555
2533
|
});
|
|
2556
2534
|
}
|
|
2535
|
+
addContextListenerOnUserChannel({ commandId, channelId, handler, invokedOnChannelModel }) {
|
|
2536
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2537
|
+
let unsubscribe;
|
|
2538
|
+
if (invokedOnChannelModel) {
|
|
2539
|
+
const contextToSubscribeTo = this.channelsParser.mapChannelNameToContextName(this.channelsStateStore.getGlueChannelNameByFdc3ChannelId(channelId));
|
|
2540
|
+
this.logger.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
|
|
2541
|
+
unsubscribe = yield this.glueController.contextsSubscribe(contextToSubscribeTo, handler);
|
|
2542
|
+
}
|
|
2543
|
+
else {
|
|
2544
|
+
this.logger.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
|
|
2545
|
+
unsubscribe = this.glueController.channelsSubscribe(handler);
|
|
2546
|
+
}
|
|
2547
|
+
return {
|
|
2548
|
+
unsubscribe: () => {
|
|
2549
|
+
this.logger.info(`[${commandId}] - invoking unsubscribe for fdc3 user channel with id ${channelId}`);
|
|
2550
|
+
unsubscribe();
|
|
2551
|
+
}
|
|
2552
|
+
};
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2557
2555
|
getChannelTypeById(channelId) {
|
|
2558
2556
|
const isUser = this.isUserChannel(channelId);
|
|
2559
2557
|
if (isUser) {
|
|
@@ -3001,48 +2999,6 @@ class GlueEventsController {
|
|
|
3001
2999
|
}
|
|
3002
3000
|
}
|
|
3003
3001
|
|
|
3004
|
-
class ChannelsPendingListenersStore {
|
|
3005
|
-
constructor() {
|
|
3006
|
-
this.pendingListeners = [];
|
|
3007
|
-
}
|
|
3008
|
-
createPendingListener(handler, contextType) {
|
|
3009
|
-
const id = nanoid();
|
|
3010
|
-
const unsubscribe = () => this.filterPendingListenersById(id);
|
|
3011
|
-
const listener = { unsubscribe };
|
|
3012
|
-
const setActualUnsub = (actualUnsub) => {
|
|
3013
|
-
listener.unsubscribe = actualUnsub;
|
|
3014
|
-
};
|
|
3015
|
-
this.pendingListeners.push({ id, handler, contextType, setActualUnsub, listener, unsubWithoutFilter: () => { } });
|
|
3016
|
-
return listener;
|
|
3017
|
-
}
|
|
3018
|
-
subscribePendingListeners(commandId, addContextListenerFn, channelId) {
|
|
3019
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3020
|
-
const listeners = yield Promise.all(this.pendingListeners.map(pendingListener => {
|
|
3021
|
-
const { handler, contextType } = pendingListener;
|
|
3022
|
-
return addContextListenerFn({ commandId, handler, contextType, channelId });
|
|
3023
|
-
}));
|
|
3024
|
-
Object.values(this.pendingListeners).forEach(({ id, setActualUnsub, unsubWithoutFilter }, index) => {
|
|
3025
|
-
unsubWithoutFilter = listeners[index].unsubscribe;
|
|
3026
|
-
const un = () => {
|
|
3027
|
-
this.filterPendingListenersById(id);
|
|
3028
|
-
unsubWithoutFilter();
|
|
3029
|
-
};
|
|
3030
|
-
setActualUnsub(un);
|
|
3031
|
-
});
|
|
3032
|
-
});
|
|
3033
|
-
}
|
|
3034
|
-
unsubscribePendingListeners() {
|
|
3035
|
-
this.pendingListeners.forEach(({ id, setActualUnsub, unsubWithoutFilter }) => {
|
|
3036
|
-
unsubWithoutFilter();
|
|
3037
|
-
const newUnsub = () => this.filterPendingListenersById(id);
|
|
3038
|
-
setActualUnsub(newUnsub);
|
|
3039
|
-
});
|
|
3040
|
-
}
|
|
3041
|
-
filterPendingListenersById(id) {
|
|
3042
|
-
this.pendingListeners = this.pendingListeners.filter((listener) => listener.id !== id);
|
|
3043
|
-
}
|
|
3044
|
-
}
|
|
3045
|
-
|
|
3046
3002
|
class IoC {
|
|
3047
3003
|
get ioc() {
|
|
3048
3004
|
return this;
|
|
@@ -3112,7 +3068,7 @@ class IoC {
|
|
|
3112
3068
|
}
|
|
3113
3069
|
get channelsController() {
|
|
3114
3070
|
if (!this._channelsController) {
|
|
3115
|
-
this._channelsController = new ChannelsController(this.glueController, this.channelsStateStore, this.channelsParser, this.channelsFactory, this.channelsCallbackRegistry
|
|
3071
|
+
this._channelsController = new ChannelsController(this.glueController, this.channelsStateStore, this.channelsParser, this.channelsFactory, this.channelsCallbackRegistry);
|
|
3116
3072
|
}
|
|
3117
3073
|
return this._channelsController;
|
|
3118
3074
|
}
|
|
@@ -3122,12 +3078,6 @@ class IoC {
|
|
|
3122
3078
|
}
|
|
3123
3079
|
return this._channelsStateStore;
|
|
3124
3080
|
}
|
|
3125
|
-
get channelsPendingListenersStore() {
|
|
3126
|
-
if (!this._channelsPendingListenersStore) {
|
|
3127
|
-
this._channelsPendingListenersStore = new ChannelsPendingListenersStore();
|
|
3128
|
-
}
|
|
3129
|
-
return this._channelsPendingListenersStore;
|
|
3130
|
-
}
|
|
3131
3081
|
get channelsCallbackRegistry() {
|
|
3132
3082
|
if (!this._channelsCallbackRegistry) {
|
|
3133
3083
|
this._channelsCallbackRegistry = new ChannelsCallbackRegistry();
|
|
@@ -3152,7 +3102,6 @@ const fdc3Factory = () => {
|
|
|
3152
3102
|
let globalFdc3 = window.fdc3;
|
|
3153
3103
|
if (typeof globalFdc3 === "undefined") {
|
|
3154
3104
|
globalFdc3 = fdc3Factory();
|
|
3155
|
-
checkIfInElectron(globalFdc3);
|
|
3156
3105
|
window.fdc3 = globalFdc3;
|
|
3157
3106
|
}
|
|
3158
3107
|
else {
|
package/dist/fdc3.umd.js
CHANGED
|
@@ -77,17 +77,6 @@
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
|
-
const checkIfInElectron = (globalFdc3) => {
|
|
81
|
-
const hasGlue42electron = typeof window !== "undefined" && "glue42electron" in window;
|
|
82
|
-
if (!hasGlue42electron) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const runningInElectron = typeof process !== "undefined" && "contextIsolated" in process;
|
|
86
|
-
if (runningInElectron) {
|
|
87
|
-
const contextBridge = require("electron").contextBridge;
|
|
88
|
-
contextBridge.exposeInMainWorld("fdc3", globalFdc3);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
80
|
const promisePlus = (promise, timeoutMilliseconds, timeoutMessage) => {
|
|
92
81
|
return new Promise((resolve, reject) => {
|
|
93
82
|
const timeout = setTimeout(() => {
|
|
@@ -1988,7 +1977,7 @@
|
|
|
1988
1977
|
}
|
|
1989
1978
|
}
|
|
1990
1979
|
|
|
1991
|
-
var version = "2.0.
|
|
1980
|
+
var version = "2.0.3";
|
|
1992
1981
|
|
|
1993
1982
|
class ApplicationsController {
|
|
1994
1983
|
constructor(glueController) {
|
|
@@ -2198,13 +2187,12 @@
|
|
|
2198
2187
|
}
|
|
2199
2188
|
|
|
2200
2189
|
class ChannelsController {
|
|
2201
|
-
constructor(glueController, channelsStateStore, channelsParser, channelsFactory, channelsCallbackRegistry
|
|
2190
|
+
constructor(glueController, channelsStateStore, channelsParser, channelsFactory, channelsCallbackRegistry) {
|
|
2202
2191
|
this.glueController = glueController;
|
|
2203
2192
|
this.channelsStateStore = channelsStateStore;
|
|
2204
2193
|
this.channelsParser = channelsParser;
|
|
2205
2194
|
this.channelsFactory = channelsFactory;
|
|
2206
2195
|
this.channelsCallbackRegistry = channelsCallbackRegistry;
|
|
2207
|
-
this.channelsPendingListenersStore = channelsPendingListenersStore;
|
|
2208
2196
|
this.invokeContextHandlerWithStartupContext = true;
|
|
2209
2197
|
this.initDonePromise = this.initialize();
|
|
2210
2198
|
this.initDonePromise.catch(() => { });
|
|
@@ -2225,7 +2213,7 @@
|
|
|
2225
2213
|
this.handleWindowContextOnOpening(commandId, handler, contextType).catch((err) => this.logger.warn(`[${commandId}] - ${err}`));
|
|
2226
2214
|
}
|
|
2227
2215
|
const channelIdToSubscribeTo = channelId || ((_a = this.channelsStateStore.currentChannel) === null || _a === void 0 ? void 0 : _a.id);
|
|
2228
|
-
return this.addContextListenerByChannelId(commandId, handler, channelIdToSubscribeTo, contextType);
|
|
2216
|
+
return this.addContextListenerByChannelId({ commandId, handler, invokedOnChannelModel: !!channelId, channelId: channelIdToSubscribeTo, contextType });
|
|
2229
2217
|
});
|
|
2230
2218
|
}
|
|
2231
2219
|
broadcast(commandId, context, channelId) {
|
|
@@ -2298,7 +2286,6 @@
|
|
|
2298
2286
|
yield this.glueController.leaveChannel();
|
|
2299
2287
|
this.channelsStateStore.currentChannel = null;
|
|
2300
2288
|
this.logger.info(`[${commandId}] - current channel is left. unsubscribing from all listeners`);
|
|
2301
|
-
this.channelsPendingListenersStore.unsubscribePendingListeners();
|
|
2302
2289
|
});
|
|
2303
2290
|
}
|
|
2304
2291
|
getContextForChannel({ commandId, channelId, contextType }) {
|
|
@@ -2413,13 +2400,10 @@
|
|
|
2413
2400
|
handleOnChannelChanged(channelId) {
|
|
2414
2401
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2415
2402
|
if (!channelId) {
|
|
2416
|
-
this.channelsPendingListenersStore.unsubscribePendingListeners();
|
|
2417
2403
|
return;
|
|
2418
2404
|
}
|
|
2419
2405
|
const isFdc3ChannelName = fdc3ChannelNames.includes(channelId);
|
|
2420
2406
|
const userChannelId = isFdc3ChannelName ? channelId : this.channelsStateStore.getFdc3ChannelIdByGlueChannelName(channelId);
|
|
2421
|
-
const commandId = nanoid();
|
|
2422
|
-
yield this.channelsPendingListenersStore.subscribePendingListeners(commandId, this.addContextListener.bind(this), userChannelId);
|
|
2423
2407
|
this.channelsStateStore.currentChannel = this.channelsStateStore.userChannels[userChannelId];
|
|
2424
2408
|
});
|
|
2425
2409
|
}
|
|
@@ -2514,23 +2498,17 @@
|
|
|
2514
2498
|
return this.glueController.channelsUpdate(glueChannelName, context);
|
|
2515
2499
|
});
|
|
2516
2500
|
}
|
|
2517
|
-
addContextListenerByChannelId(commandId, handler,
|
|
2501
|
+
addContextListenerByChannelId({ commandId, channelId, handler, contextType, invokedOnChannelModel }) {
|
|
2518
2502
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2519
2503
|
const subHandler = parseContextHandler(handler, contextType);
|
|
2520
2504
|
if (!channelId) {
|
|
2521
|
-
this.logger.info(`[${commandId}] -
|
|
2522
|
-
|
|
2505
|
+
this.logger.info(`[${commandId}] - Creating a channel subscription using glue.channels.subscribe`);
|
|
2506
|
+
const unsubscribe = this.glueController.channelsSubscribe(subHandler);
|
|
2507
|
+
return { unsubscribe };
|
|
2523
2508
|
}
|
|
2524
2509
|
const channelType = this.getChannelTypeById(channelId);
|
|
2525
2510
|
if (channelType === ChannelTypes.User) {
|
|
2526
|
-
this.
|
|
2527
|
-
const unsubscribe = this.glueController.channelsSubscribe(subHandler);
|
|
2528
|
-
return {
|
|
2529
|
-
unsubscribe: () => {
|
|
2530
|
-
this.logger.info(`[${commandId}] - invoking unsubscribe for fdc3 user channel with id ${channelId}`);
|
|
2531
|
-
unsubscribe();
|
|
2532
|
-
}
|
|
2533
|
-
};
|
|
2511
|
+
return this.addContextListenerOnUserChannel({ commandId, channelId, handler: subHandler, contextType, invokedOnChannelModel });
|
|
2534
2512
|
}
|
|
2535
2513
|
if (channelType === ChannelTypes.App) {
|
|
2536
2514
|
this.logger.info(`[${commandId}] - subscribing for fdc3 app channel with id ${channelId} (underlying glue context with same name)`);
|
|
@@ -2560,6 +2538,26 @@
|
|
|
2560
2538
|
throw { message: ChannelError.AccessDenied, reason: "Cannot add a context listener on an invalid channel" };
|
|
2561
2539
|
});
|
|
2562
2540
|
}
|
|
2541
|
+
addContextListenerOnUserChannel({ commandId, channelId, handler, invokedOnChannelModel }) {
|
|
2542
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2543
|
+
let unsubscribe;
|
|
2544
|
+
if (invokedOnChannelModel) {
|
|
2545
|
+
const contextToSubscribeTo = this.channelsParser.mapChannelNameToContextName(this.channelsStateStore.getGlueChannelNameByFdc3ChannelId(channelId));
|
|
2546
|
+
this.logger.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
|
|
2547
|
+
unsubscribe = yield this.glueController.contextsSubscribe(contextToSubscribeTo, handler);
|
|
2548
|
+
}
|
|
2549
|
+
else {
|
|
2550
|
+
this.logger.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
|
|
2551
|
+
unsubscribe = this.glueController.channelsSubscribe(handler);
|
|
2552
|
+
}
|
|
2553
|
+
return {
|
|
2554
|
+
unsubscribe: () => {
|
|
2555
|
+
this.logger.info(`[${commandId}] - invoking unsubscribe for fdc3 user channel with id ${channelId}`);
|
|
2556
|
+
unsubscribe();
|
|
2557
|
+
}
|
|
2558
|
+
};
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2563
2561
|
getChannelTypeById(channelId) {
|
|
2564
2562
|
const isUser = this.isUserChannel(channelId);
|
|
2565
2563
|
if (isUser) {
|
|
@@ -3007,48 +3005,6 @@
|
|
|
3007
3005
|
}
|
|
3008
3006
|
}
|
|
3009
3007
|
|
|
3010
|
-
class ChannelsPendingListenersStore {
|
|
3011
|
-
constructor() {
|
|
3012
|
-
this.pendingListeners = [];
|
|
3013
|
-
}
|
|
3014
|
-
createPendingListener(handler, contextType) {
|
|
3015
|
-
const id = nanoid();
|
|
3016
|
-
const unsubscribe = () => this.filterPendingListenersById(id);
|
|
3017
|
-
const listener = { unsubscribe };
|
|
3018
|
-
const setActualUnsub = (actualUnsub) => {
|
|
3019
|
-
listener.unsubscribe = actualUnsub;
|
|
3020
|
-
};
|
|
3021
|
-
this.pendingListeners.push({ id, handler, contextType, setActualUnsub, listener, unsubWithoutFilter: () => { } });
|
|
3022
|
-
return listener;
|
|
3023
|
-
}
|
|
3024
|
-
subscribePendingListeners(commandId, addContextListenerFn, channelId) {
|
|
3025
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3026
|
-
const listeners = yield Promise.all(this.pendingListeners.map(pendingListener => {
|
|
3027
|
-
const { handler, contextType } = pendingListener;
|
|
3028
|
-
return addContextListenerFn({ commandId, handler, contextType, channelId });
|
|
3029
|
-
}));
|
|
3030
|
-
Object.values(this.pendingListeners).forEach(({ id, setActualUnsub, unsubWithoutFilter }, index) => {
|
|
3031
|
-
unsubWithoutFilter = listeners[index].unsubscribe;
|
|
3032
|
-
const un = () => {
|
|
3033
|
-
this.filterPendingListenersById(id);
|
|
3034
|
-
unsubWithoutFilter();
|
|
3035
|
-
};
|
|
3036
|
-
setActualUnsub(un);
|
|
3037
|
-
});
|
|
3038
|
-
});
|
|
3039
|
-
}
|
|
3040
|
-
unsubscribePendingListeners() {
|
|
3041
|
-
this.pendingListeners.forEach(({ id, setActualUnsub, unsubWithoutFilter }) => {
|
|
3042
|
-
unsubWithoutFilter();
|
|
3043
|
-
const newUnsub = () => this.filterPendingListenersById(id);
|
|
3044
|
-
setActualUnsub(newUnsub);
|
|
3045
|
-
});
|
|
3046
|
-
}
|
|
3047
|
-
filterPendingListenersById(id) {
|
|
3048
|
-
this.pendingListeners = this.pendingListeners.filter((listener) => listener.id !== id);
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
3008
|
class IoC {
|
|
3053
3009
|
get ioc() {
|
|
3054
3010
|
return this;
|
|
@@ -3118,7 +3074,7 @@
|
|
|
3118
3074
|
}
|
|
3119
3075
|
get channelsController() {
|
|
3120
3076
|
if (!this._channelsController) {
|
|
3121
|
-
this._channelsController = new ChannelsController(this.glueController, this.channelsStateStore, this.channelsParser, this.channelsFactory, this.channelsCallbackRegistry
|
|
3077
|
+
this._channelsController = new ChannelsController(this.glueController, this.channelsStateStore, this.channelsParser, this.channelsFactory, this.channelsCallbackRegistry);
|
|
3122
3078
|
}
|
|
3123
3079
|
return this._channelsController;
|
|
3124
3080
|
}
|
|
@@ -3128,12 +3084,6 @@
|
|
|
3128
3084
|
}
|
|
3129
3085
|
return this._channelsStateStore;
|
|
3130
3086
|
}
|
|
3131
|
-
get channelsPendingListenersStore() {
|
|
3132
|
-
if (!this._channelsPendingListenersStore) {
|
|
3133
|
-
this._channelsPendingListenersStore = new ChannelsPendingListenersStore();
|
|
3134
|
-
}
|
|
3135
|
-
return this._channelsPendingListenersStore;
|
|
3136
|
-
}
|
|
3137
3087
|
get channelsCallbackRegistry() {
|
|
3138
3088
|
if (!this._channelsCallbackRegistry) {
|
|
3139
3089
|
this._channelsCallbackRegistry = new ChannelsCallbackRegistry();
|
|
@@ -3158,7 +3108,6 @@
|
|
|
3158
3108
|
let globalFdc3 = window.fdc3;
|
|
3159
3109
|
if (typeof globalFdc3 === "undefined") {
|
|
3160
3110
|
globalFdc3 = fdc3Factory();
|
|
3161
|
-
checkIfInElectron(globalFdc3);
|
|
3162
3111
|
window.fdc3 = globalFdc3;
|
|
3163
3112
|
}
|
|
3164
3113
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interopio/fdc3",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "IO Connect implementation of the FDC3 standard",
|
|
5
5
|
"main": "dist/fdc3.umd.js",
|
|
6
6
|
"module": "dist/fdc3.es.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"homepage": "https://interop.io/",
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "rollup -c",
|
|
22
|
+
"build": "rollup -c && rollup -c ./rollup.config.electron.js",
|
|
23
23
|
"test": "echo no tests found",
|
|
24
24
|
"audit": "echo no audit found",
|
|
25
25
|
"audit:V1": "node ../../scripts/audit/index.js",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@rollup/plugin-commonjs": "^23.0.5",
|
|
36
36
|
"@rollup/plugin-json": "^5.0.2",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
38
|
+
"@rollup/plugin-replace": "^5.0.4",
|
|
38
39
|
"rollup": "^3.7.4",
|
|
39
40
|
"rollup-plugin-delete": "^2.0.0",
|
|
40
41
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
@@ -49,5 +50,5 @@
|
|
|
49
50
|
"decoder-validate": "^0.0.2",
|
|
50
51
|
"nanoid": "^4.0.0"
|
|
51
52
|
},
|
|
52
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "39feb711eb3281a345a69315e35bbfcb220ee7e1"
|
|
53
54
|
}
|