@openfin/remote-adapter 42.100.36 → 42.100.42
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/remote-adapter.js +1318 -1264
- package/package.json +2 -2
package/out/remote-adapter.js
CHANGED
|
@@ -49,13 +49,13 @@ async function promiseMapSerial(arr, func) {
|
|
|
49
49
|
}
|
|
50
50
|
promises.promiseMapSerial = promiseMapSerial;
|
|
51
51
|
|
|
52
|
-
var __classPrivateFieldSet$
|
|
52
|
+
var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
53
53
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
54
54
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
55
55
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
56
56
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
57
57
|
};
|
|
58
|
-
var __classPrivateFieldGet$
|
|
58
|
+
var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
59
59
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
60
60
|
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");
|
|
61
61
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -140,7 +140,7 @@ class EmitterBase extends Base {
|
|
|
140
140
|
this.emit = (eventType, payload, ...args) => {
|
|
141
141
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
142
142
|
};
|
|
143
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$
|
|
143
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
144
144
|
/**
|
|
145
145
|
* Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
|
|
146
146
|
* `once` subscription.
|
|
@@ -150,14 +150,14 @@ class EmitterBase extends Base {
|
|
|
150
150
|
* which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
|
|
151
151
|
*/
|
|
152
152
|
this.cleanUpRemovedListener = (eventType, listener) => {
|
|
153
|
-
const deregister = __classPrivateFieldGet$
|
|
153
|
+
const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
154
154
|
if (deregister) {
|
|
155
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
155
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
156
156
|
emitter.removeListener(eventType, deregister);
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
this.getOrCreateEmitter = () => {
|
|
160
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
160
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
161
161
|
if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
|
|
162
162
|
emitter.on('removeListener', this.cleanUpRemovedListener);
|
|
163
163
|
}
|
|
@@ -199,8 +199,8 @@ class EmitterBase extends Base {
|
|
|
199
199
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
|
200
200
|
return Promise.resolve();
|
|
201
201
|
};
|
|
202
|
-
__classPrivateFieldSet$
|
|
203
|
-
__classPrivateFieldSet$
|
|
202
|
+
__classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
203
|
+
__classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
204
204
|
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
@@ -229,7 +229,7 @@ class EmitterBase extends Base {
|
|
|
229
229
|
*/
|
|
230
230
|
async once(eventType, listener, options) {
|
|
231
231
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
232
|
-
__classPrivateFieldGet$
|
|
232
|
+
__classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
233
233
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
234
234
|
emitter.once(eventType, deregister);
|
|
235
235
|
emitter.once(eventType, listener);
|
|
@@ -260,7 +260,7 @@ class EmitterBase extends Base {
|
|
|
260
260
|
*/
|
|
261
261
|
async prependOnceListener(eventType, listener, options) {
|
|
262
262
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
263
|
-
__classPrivateFieldGet$
|
|
263
|
+
__classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
264
264
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
265
265
|
emitter.prependOnceListener(eventType, listener);
|
|
266
266
|
emitter.once(eventType, deregister);
|
|
@@ -320,7 +320,7 @@ class EmitterBase extends Base {
|
|
|
320
320
|
}
|
|
321
321
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
322
322
|
if (emitter.eventNames().every((type) => type === 'removeListener')) {
|
|
323
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet$
|
|
323
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
}
|
|
@@ -851,13 +851,13 @@ class AsyncRetryableLazy {
|
|
|
851
851
|
}
|
|
852
852
|
lazy.AsyncRetryableLazy = AsyncRetryableLazy;
|
|
853
853
|
|
|
854
|
-
var __classPrivateFieldSet$
|
|
854
|
+
var __classPrivateFieldSet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
855
855
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
856
856
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
857
857
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
858
858
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
859
859
|
};
|
|
860
|
-
var __classPrivateFieldGet$
|
|
860
|
+
var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
861
861
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
862
862
|
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");
|
|
863
863
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -868,7 +868,7 @@ var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
|
|
|
868
868
|
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
|
|
869
869
|
Object.defineProperty(InteropBroker$1, "__esModule", { value: true });
|
|
870
870
|
InteropBroker$1.InteropBroker = void 0;
|
|
871
|
-
const base_1$
|
|
871
|
+
const base_1$m = base;
|
|
872
872
|
const SessionContextGroupBroker_1 = __importDefault$6(SessionContextGroupBroker$1);
|
|
873
873
|
const utils_1$7 = utils$3;
|
|
874
874
|
const isEqual_1$1 = __importDefault$6(require$$3);
|
|
@@ -1037,7 +1037,7 @@ const defaultContextGroups = [
|
|
|
1037
1037
|
* ---
|
|
1038
1038
|
*
|
|
1039
1039
|
*/
|
|
1040
|
-
class InteropBroker extends base_1$
|
|
1040
|
+
class InteropBroker extends base_1$m.Base {
|
|
1041
1041
|
/**
|
|
1042
1042
|
* @internal
|
|
1043
1043
|
*/
|
|
@@ -1048,19 +1048,19 @@ class InteropBroker extends base_1$o.Base {
|
|
|
1048
1048
|
_InteropBroker_contextGroups.set(this, void 0);
|
|
1049
1049
|
_InteropBroker_providerPromise.set(this, void 0);
|
|
1050
1050
|
this.getProvider = () => {
|
|
1051
|
-
return __classPrivateFieldGet$
|
|
1051
|
+
return __classPrivateFieldGet$h(this, _InteropBroker_providerPromise, "f").getValue();
|
|
1052
1052
|
};
|
|
1053
1053
|
this.interopClients = new Map();
|
|
1054
1054
|
this.contextGroupsById = new Map();
|
|
1055
|
-
__classPrivateFieldSet$
|
|
1056
|
-
__classPrivateFieldSet$
|
|
1055
|
+
__classPrivateFieldSet$g(this, _InteropBroker_contextGroups, options.contextGroups ?? [...defaultContextGroups], "f");
|
|
1056
|
+
__classPrivateFieldSet$g(this, _InteropBroker_fdc3Info, options.fdc3Info, "f");
|
|
1057
1057
|
if (options?.logging) {
|
|
1058
1058
|
this.logging = options.logging;
|
|
1059
1059
|
}
|
|
1060
1060
|
this.intentClientMap = new Map();
|
|
1061
1061
|
this.lastContextMap = new Map();
|
|
1062
1062
|
this.sessionContextGroupMap = new Map();
|
|
1063
|
-
__classPrivateFieldSet$
|
|
1063
|
+
__classPrivateFieldSet$g(this, _InteropBroker_providerPromise, new lazy_1$2.Lazy(createProvider), "f");
|
|
1064
1064
|
this.setContextGroupMap();
|
|
1065
1065
|
this.setupChannelProvider();
|
|
1066
1066
|
}
|
|
@@ -1328,7 +1328,7 @@ class InteropBroker extends base_1$o.Base {
|
|
|
1328
1328
|
// don't expose, analytics-only call
|
|
1329
1329
|
});
|
|
1330
1330
|
// Create copy for immutability
|
|
1331
|
-
return __classPrivateFieldGet$
|
|
1331
|
+
return __classPrivateFieldGet$h(this, _InteropBroker_contextGroups, "f").map((contextGroup) => {
|
|
1332
1332
|
return { ...contextGroup };
|
|
1333
1333
|
});
|
|
1334
1334
|
}
|
|
@@ -1739,7 +1739,7 @@ class InteropBroker extends base_1$o.Base {
|
|
|
1739
1739
|
const { fdc3Version } = payload;
|
|
1740
1740
|
return {
|
|
1741
1741
|
fdc3Version,
|
|
1742
|
-
...__classPrivateFieldGet$
|
|
1742
|
+
...__classPrivateFieldGet$h(this, _InteropBroker_fdc3Info, "f"),
|
|
1743
1743
|
optionalFeatures: {
|
|
1744
1744
|
OriginatingAppMetadata: false,
|
|
1745
1745
|
UserChannelMembershipAPIs: true
|
|
@@ -2583,11 +2583,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
|
2583
2583
|
};
|
|
2584
2584
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
|
2585
2585
|
|
|
2586
|
-
var hasRequiredFactory$
|
|
2586
|
+
var hasRequiredFactory$2;
|
|
2587
2587
|
|
|
2588
|
-
function requireFactory$
|
|
2589
|
-
if (hasRequiredFactory$
|
|
2590
|
-
hasRequiredFactory$
|
|
2588
|
+
function requireFactory$2 () {
|
|
2589
|
+
if (hasRequiredFactory$2) return Factory$8;
|
|
2590
|
+
hasRequiredFactory$2 = 1;
|
|
2591
2591
|
Object.defineProperty(Factory$8, "__esModule", { value: true });
|
|
2592
2592
|
Factory$8.ViewModule = void 0;
|
|
2593
2593
|
const base_1 = base;
|
|
@@ -2746,8 +2746,8 @@ var main = {};
|
|
|
2746
2746
|
|
|
2747
2747
|
Object.defineProperty(main, "__esModule", { value: true });
|
|
2748
2748
|
main.WebContents = void 0;
|
|
2749
|
-
const base_1$
|
|
2750
|
-
class WebContents extends base_1$
|
|
2749
|
+
const base_1$l = base;
|
|
2750
|
+
class WebContents extends base_1$l.EmitterBase {
|
|
2751
2751
|
/**
|
|
2752
2752
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
2753
2753
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
@@ -3840,1133 +3840,1154 @@ var Factory$6 = {};
|
|
|
3840
3840
|
|
|
3841
3841
|
var Instance$5 = {};
|
|
3842
3842
|
|
|
3843
|
-
|
|
3844
|
-
Instance$5.Application = void 0;
|
|
3845
|
-
/* eslint-disable import/prefer-default-export */
|
|
3846
|
-
const base_1$m = base;
|
|
3847
|
-
const window_1$1 = requireWindow();
|
|
3848
|
-
const view_1 = requireView();
|
|
3849
|
-
/**
|
|
3850
|
-
* An object representing an application. Allows the developer to create,
|
|
3851
|
-
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
3852
|
-
*/
|
|
3853
|
-
class Application extends base_1$m.EmitterBase {
|
|
3854
|
-
/**
|
|
3855
|
-
* @internal
|
|
3856
|
-
*/
|
|
3857
|
-
constructor(wire, identity) {
|
|
3858
|
-
super(wire, 'application', identity.uuid);
|
|
3859
|
-
this.identity = identity;
|
|
3860
|
-
this.window = new window_1$1._Window(this.wire, {
|
|
3861
|
-
uuid: this.identity.uuid,
|
|
3862
|
-
name: this.identity.uuid
|
|
3863
|
-
});
|
|
3864
|
-
}
|
|
3865
|
-
windowListFromIdentityList(identityList) {
|
|
3866
|
-
const windowList = [];
|
|
3867
|
-
identityList.forEach((identity) => {
|
|
3868
|
-
windowList.push(new window_1$1._Window(this.wire, {
|
|
3869
|
-
uuid: identity.uuid,
|
|
3870
|
-
name: identity.name
|
|
3871
|
-
}));
|
|
3872
|
-
});
|
|
3873
|
-
return windowList;
|
|
3874
|
-
}
|
|
3875
|
-
/**
|
|
3876
|
-
* Determines if the application is currently running.
|
|
3877
|
-
*
|
|
3878
|
-
* @example
|
|
3879
|
-
*
|
|
3880
|
-
* ```js
|
|
3881
|
-
* async function isAppRunning() {
|
|
3882
|
-
* const app = await fin.Application.getCurrent();
|
|
3883
|
-
* return await app.isRunning();
|
|
3884
|
-
* }
|
|
3885
|
-
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
3886
|
-
* ```
|
|
3887
|
-
*/
|
|
3888
|
-
isRunning() {
|
|
3889
|
-
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
3890
|
-
}
|
|
3891
|
-
/**
|
|
3892
|
-
* Closes the application and any child windows created by the application.
|
|
3893
|
-
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
3894
|
-
* @param force Close will be prevented from closing when force is false and
|
|
3895
|
-
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
3896
|
-
*
|
|
3897
|
-
* @example
|
|
3898
|
-
*
|
|
3899
|
-
* ```js
|
|
3900
|
-
* async function closeApp() {
|
|
3901
|
-
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
3902
|
-
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
3903
|
-
* await app.quit();
|
|
3904
|
-
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
3905
|
-
*
|
|
3906
|
-
* }
|
|
3907
|
-
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
3908
|
-
* ```
|
|
3909
|
-
*/
|
|
3910
|
-
async quit(force = false) {
|
|
3911
|
-
try {
|
|
3912
|
-
await this._close(force);
|
|
3913
|
-
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
3914
|
-
}
|
|
3915
|
-
catch (error) {
|
|
3916
|
-
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
3917
|
-
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
3918
|
-
throw error;
|
|
3919
|
-
}
|
|
3920
|
-
}
|
|
3921
|
-
}
|
|
3922
|
-
async _close(force = false) {
|
|
3923
|
-
try {
|
|
3924
|
-
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
3925
|
-
}
|
|
3926
|
-
catch (error) {
|
|
3927
|
-
if (!error.message.includes('Remote connection has closed')) {
|
|
3928
|
-
throw error;
|
|
3929
|
-
}
|
|
3930
|
-
}
|
|
3931
|
-
}
|
|
3932
|
-
/**
|
|
3933
|
-
* @deprecated use Application.quit instead
|
|
3934
|
-
* Closes the application and any child windows created by the application.
|
|
3935
|
-
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
3936
|
-
* @param callback - called if the method succeeds.
|
|
3937
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
3938
|
-
*
|
|
3939
|
-
* @example
|
|
3940
|
-
*
|
|
3941
|
-
* ```js
|
|
3942
|
-
* async function closeApp() {
|
|
3943
|
-
* const app = await fin.Application.getCurrent();
|
|
3944
|
-
* return await app.close();
|
|
3945
|
-
* }
|
|
3946
|
-
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
3947
|
-
* ```
|
|
3948
|
-
*/
|
|
3949
|
-
close(force = false) {
|
|
3950
|
-
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
3951
|
-
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
|
3952
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3953
|
-
});
|
|
3954
|
-
return this._close(force);
|
|
3955
|
-
}
|
|
3956
|
-
/**
|
|
3957
|
-
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
3958
|
-
*
|
|
3959
|
-
* @example
|
|
3960
|
-
*
|
|
3961
|
-
* ```js
|
|
3962
|
-
* async function getChildWindows() {
|
|
3963
|
-
* const app = await fin.Application.getCurrent();
|
|
3964
|
-
* return await app.getChildWindows();
|
|
3965
|
-
* }
|
|
3966
|
-
*
|
|
3967
|
-
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
3968
|
-
* ```
|
|
3969
|
-
*/
|
|
3970
|
-
getChildWindows() {
|
|
3971
|
-
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
3972
|
-
const identityList = [];
|
|
3973
|
-
payload.data.forEach((winName) => {
|
|
3974
|
-
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
3975
|
-
});
|
|
3976
|
-
return this.windowListFromIdentityList(identityList);
|
|
3977
|
-
});
|
|
3978
|
-
}
|
|
3979
|
-
/**
|
|
3980
|
-
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
3981
|
-
* if the application was not created from a manifest.
|
|
3982
|
-
*
|
|
3983
|
-
* @example
|
|
3984
|
-
*
|
|
3985
|
-
* ```js
|
|
3986
|
-
* async function getManifest() {
|
|
3987
|
-
* const app = await fin.Application.getCurrent();
|
|
3988
|
-
* return await app.getManifest();
|
|
3989
|
-
* }
|
|
3990
|
-
*
|
|
3991
|
-
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
3992
|
-
* ```
|
|
3993
|
-
*/
|
|
3994
|
-
getManifest() {
|
|
3995
|
-
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
3996
|
-
}
|
|
3997
|
-
/**
|
|
3998
|
-
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
3999
|
-
* if the application was created from a manifest.
|
|
4000
|
-
*
|
|
4001
|
-
* @example
|
|
4002
|
-
*
|
|
4003
|
-
* ```js
|
|
4004
|
-
* async function getParentUuid() {
|
|
4005
|
-
* const app = await fin.Application.start({
|
|
4006
|
-
* uuid: 'app-1',
|
|
4007
|
-
* name: 'myApp',
|
|
4008
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
4009
|
-
* autoShow: true
|
|
4010
|
-
* });
|
|
4011
|
-
* return await app.getParentUuid();
|
|
4012
|
-
* }
|
|
4013
|
-
*
|
|
4014
|
-
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
4015
|
-
* ```
|
|
4016
|
-
*/
|
|
4017
|
-
getParentUuid() {
|
|
4018
|
-
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
4019
|
-
}
|
|
4020
|
-
/**
|
|
4021
|
-
* Retrieves current application's shortcut configuration.
|
|
4022
|
-
*
|
|
4023
|
-
* @example
|
|
4024
|
-
*
|
|
4025
|
-
* ```js
|
|
4026
|
-
* async function getShortcuts() {
|
|
4027
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
4028
|
-
* return await app.getShortcuts();
|
|
4029
|
-
* }
|
|
4030
|
-
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
4031
|
-
* ```
|
|
4032
|
-
*/
|
|
4033
|
-
getShortcuts() {
|
|
4034
|
-
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
4035
|
-
}
|
|
4036
|
-
/**
|
|
4037
|
-
* Retrieves current application's views.
|
|
4038
|
-
* @experimental
|
|
4039
|
-
*
|
|
4040
|
-
* @example
|
|
4041
|
-
*
|
|
4042
|
-
* ```js
|
|
4043
|
-
* async function getViews() {
|
|
4044
|
-
* const app = await fin.Application.getCurrent();
|
|
4045
|
-
* return await app.getViews();
|
|
4046
|
-
* }
|
|
4047
|
-
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
4048
|
-
* ```
|
|
4049
|
-
*/
|
|
4050
|
-
async getViews() {
|
|
4051
|
-
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
4052
|
-
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
4053
|
-
}
|
|
4054
|
-
/**
|
|
4055
|
-
* Returns the current zoom level of the application.
|
|
4056
|
-
*
|
|
4057
|
-
* @example
|
|
4058
|
-
*
|
|
4059
|
-
* ```js
|
|
4060
|
-
* async function getZoomLevel() {
|
|
4061
|
-
* const app = await fin.Application.getCurrent();
|
|
4062
|
-
* return await app.getZoomLevel();
|
|
4063
|
-
* }
|
|
4064
|
-
*
|
|
4065
|
-
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
4066
|
-
* ```
|
|
4067
|
-
*/
|
|
4068
|
-
getZoomLevel() {
|
|
4069
|
-
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
4070
|
-
}
|
|
4071
|
-
/**
|
|
4072
|
-
* Returns an instance of the main Window of the application
|
|
4073
|
-
*
|
|
4074
|
-
* @example
|
|
4075
|
-
*
|
|
4076
|
-
* ```js
|
|
4077
|
-
* async function getWindow() {
|
|
4078
|
-
* const app = await fin.Application.start({
|
|
4079
|
-
* uuid: 'app-1',
|
|
4080
|
-
* name: 'myApp',
|
|
4081
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
4082
|
-
* autoShow: true
|
|
4083
|
-
* });
|
|
4084
|
-
* return await app.getWindow();
|
|
4085
|
-
* }
|
|
4086
|
-
*
|
|
4087
|
-
* getWindow().then(win => {
|
|
4088
|
-
* win.showAt(0, 400);
|
|
4089
|
-
* win.flash();
|
|
4090
|
-
* }).catch(err => console.log(err));
|
|
4091
|
-
* ```
|
|
4092
|
-
*/
|
|
4093
|
-
getWindow() {
|
|
4094
|
-
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
|
4095
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4096
|
-
});
|
|
4097
|
-
return Promise.resolve(this.window);
|
|
4098
|
-
}
|
|
4099
|
-
/**
|
|
4100
|
-
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
4101
|
-
* @param userName - username to be passed to the RVM.
|
|
4102
|
-
* @param appName - app name to be passed to the RVM.
|
|
4103
|
-
*
|
|
4104
|
-
* @example
|
|
4105
|
-
*
|
|
4106
|
-
* ```js
|
|
4107
|
-
* async function registerUser() {
|
|
4108
|
-
* const app = await fin.Application.getCurrent();
|
|
4109
|
-
* return await app.registerUser('user', 'myApp');
|
|
4110
|
-
* }
|
|
4111
|
-
*
|
|
4112
|
-
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
4113
|
-
* ```
|
|
4114
|
-
*/
|
|
4115
|
-
registerUser(userName, appName) {
|
|
4116
|
-
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
4117
|
-
}
|
|
4118
|
-
/**
|
|
4119
|
-
* Removes the application’s icon from the tray.
|
|
4120
|
-
*
|
|
4121
|
-
* @example
|
|
4122
|
-
*
|
|
4123
|
-
* ```js
|
|
4124
|
-
* async function removeTrayIcon() {
|
|
4125
|
-
* const app = await fin.Application.getCurrent();
|
|
4126
|
-
* return await app.removeTrayIcon();
|
|
4127
|
-
* }
|
|
4128
|
-
*
|
|
4129
|
-
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
4130
|
-
* ```
|
|
4131
|
-
*/
|
|
4132
|
-
removeTrayIcon() {
|
|
4133
|
-
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
4134
|
-
}
|
|
4135
|
-
/**
|
|
4136
|
-
* Restarts the application.
|
|
4137
|
-
*
|
|
4138
|
-
* @example
|
|
4139
|
-
*
|
|
4140
|
-
* ```js
|
|
4141
|
-
* async function restartApp() {
|
|
4142
|
-
* const app = await fin.Application.getCurrent();
|
|
4143
|
-
* return await app.restart();
|
|
4144
|
-
* }
|
|
4145
|
-
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
4146
|
-
* ```
|
|
4147
|
-
*/
|
|
4148
|
-
restart() {
|
|
4149
|
-
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
4150
|
-
}
|
|
4151
|
-
/**
|
|
4152
|
-
* DEPRECATED method to run the application.
|
|
4153
|
-
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
4154
|
-
*
|
|
4155
|
-
* @example
|
|
4156
|
-
*
|
|
4157
|
-
* ```js
|
|
4158
|
-
* async function run() {
|
|
4159
|
-
* const app = await fin.Application.create({
|
|
4160
|
-
* name: 'myApp',
|
|
4161
|
-
* uuid: 'app-1',
|
|
4162
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
4163
|
-
* autoShow: true
|
|
4164
|
-
* });
|
|
4165
|
-
* await app.run();
|
|
4166
|
-
* }
|
|
4167
|
-
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
4168
|
-
* ```
|
|
4169
|
-
*
|
|
4170
|
-
* @ignore
|
|
4171
|
-
*/
|
|
4172
|
-
run() {
|
|
4173
|
-
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
4174
|
-
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
|
4175
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4176
|
-
});
|
|
4177
|
-
return this._run();
|
|
4178
|
-
}
|
|
4179
|
-
_run(opts = {}) {
|
|
4180
|
-
return this.wire
|
|
4181
|
-
.sendAction('run-application', {
|
|
4182
|
-
manifestUrl: this._manifestUrl,
|
|
4183
|
-
opts,
|
|
4184
|
-
...this.identity
|
|
4185
|
-
})
|
|
4186
|
-
.then(() => undefined);
|
|
4187
|
-
}
|
|
4188
|
-
/**
|
|
4189
|
-
* Instructs the RVM to schedule one restart of the application.
|
|
4190
|
-
*
|
|
4191
|
-
* @example
|
|
4192
|
-
*
|
|
4193
|
-
* ```js
|
|
4194
|
-
* async function scheduleRestart() {
|
|
4195
|
-
* const app = await fin.Application.getCurrent();
|
|
4196
|
-
* return await app.scheduleRestart();
|
|
4197
|
-
* }
|
|
4198
|
-
*
|
|
4199
|
-
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
4200
|
-
* ```
|
|
4201
|
-
*/
|
|
4202
|
-
scheduleRestart() {
|
|
4203
|
-
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
4204
|
-
}
|
|
4205
|
-
/**
|
|
4206
|
-
* Sends a message to the RVM to upload the application's logs. On success,
|
|
4207
|
-
* an object containing logId is returned.
|
|
4208
|
-
*
|
|
4209
|
-
* @example
|
|
4210
|
-
*
|
|
4211
|
-
* ```js
|
|
4212
|
-
* async function sendLog() {
|
|
4213
|
-
* const app = await fin.Application.getCurrent();
|
|
4214
|
-
* return await app.sendApplicationLog();
|
|
4215
|
-
* }
|
|
4216
|
-
*
|
|
4217
|
-
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
4218
|
-
* ```
|
|
4219
|
-
*/
|
|
4220
|
-
async sendApplicationLog() {
|
|
4221
|
-
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
4222
|
-
return payload.data;
|
|
4223
|
-
}
|
|
4224
|
-
/**
|
|
4225
|
-
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
4226
|
-
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
4227
|
-
*
|
|
4228
|
-
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
4229
|
-
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
4230
|
-
*
|
|
4231
|
-
*
|
|
4232
|
-
* @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
4233
|
-
*
|
|
4234
|
-
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
4235
|
-
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
4236
|
-
*
|
|
4237
|
-
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
4238
|
-
*
|
|
4239
|
-
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
4240
|
-
* uuid or shortcut.name is changed.
|
|
4241
|
-
*
|
|
4242
|
-
* @example
|
|
4243
|
-
*
|
|
4244
|
-
* ```js
|
|
4245
|
-
* const app = fin.Application.getCurrentSync();
|
|
4246
|
-
* const appName = 'My App';
|
|
4247
|
-
* const jumpListConfig = [ // array of JumpList categories
|
|
4248
|
-
* {
|
|
4249
|
-
* // has no name and no type so `type` is assumed to be "tasks"
|
|
4250
|
-
* items: [ // array of JumpList items
|
|
4251
|
-
* {
|
|
4252
|
-
* type: 'task',
|
|
4253
|
-
* title: `Launch ${appName}`,
|
|
4254
|
-
* description: `Runs ${appName} with the default configuration`,
|
|
4255
|
-
* deepLink: 'fins://path.to/app/manifest.json',
|
|
4256
|
-
* iconPath: 'https://path.to/app/icon.ico',
|
|
4257
|
-
* iconIndex: 0
|
|
4258
|
-
* },
|
|
4259
|
-
* { type: 'separator' },
|
|
4260
|
-
* {
|
|
4261
|
-
* type: 'task',
|
|
4262
|
-
* title: `Restore ${appName}`,
|
|
4263
|
-
* description: 'Restore to last configuration',
|
|
4264
|
-
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
4265
|
-
* iconPath: 'https://path.to/app/icon.ico',
|
|
4266
|
-
* iconIndex: 0
|
|
4267
|
-
* },
|
|
4268
|
-
* ]
|
|
4269
|
-
* },
|
|
4270
|
-
* {
|
|
4271
|
-
* name: 'Tools',
|
|
4272
|
-
* items: [ // array of JumpList items
|
|
4273
|
-
* {
|
|
4274
|
-
* type: 'task',
|
|
4275
|
-
* title: 'Tool A',
|
|
4276
|
-
* description: 'Runs Tool A',
|
|
4277
|
-
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
4278
|
-
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
4279
|
-
* iconIndex: 0
|
|
4280
|
-
* },
|
|
4281
|
-
* {
|
|
4282
|
-
* type: 'task',
|
|
4283
|
-
* title: 'Tool B',
|
|
4284
|
-
* description: 'Runs Tool B',
|
|
4285
|
-
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
4286
|
-
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
4287
|
-
* iconIndex: 0
|
|
4288
|
-
* }]
|
|
4289
|
-
* }
|
|
4290
|
-
* ];
|
|
4291
|
-
*
|
|
4292
|
-
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
4293
|
-
* ```
|
|
4294
|
-
*
|
|
4295
|
-
* To handle deeplink args:
|
|
4296
|
-
* ```js
|
|
4297
|
-
* function handleUseLastConfiguration() {
|
|
4298
|
-
* // this handler is called when the app is being launched
|
|
4299
|
-
* app.on('run-requested', event => {
|
|
4300
|
-
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
4301
|
-
* // your logic here
|
|
4302
|
-
* }
|
|
4303
|
-
* });
|
|
4304
|
-
* // this handler is called when the app was already running when the launch was requested
|
|
4305
|
-
* fin.desktop.main(function(args) {
|
|
4306
|
-
* if(args && args['use-last-configuration']) {
|
|
4307
|
-
* // your logic here
|
|
4308
|
-
* }
|
|
4309
|
-
* });
|
|
4310
|
-
* }
|
|
4311
|
-
* ```
|
|
4312
|
-
*/
|
|
4313
|
-
async setJumpList(jumpListCategories) {
|
|
4314
|
-
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
4315
|
-
}
|
|
4316
|
-
/**
|
|
4317
|
-
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
4318
|
-
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
4319
|
-
*
|
|
4320
|
-
* @example
|
|
4321
|
-
*
|
|
4322
|
-
* ```js
|
|
4323
|
-
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
4324
|
-
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
4325
|
-
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
4326
|
-
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
4327
|
-
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
4328
|
-
*
|
|
4329
|
-
* async function setTrayIcon(icon) {
|
|
4330
|
-
* const app = await fin.Application.getCurrent();
|
|
4331
|
-
* return await app.setTrayIcon(icon);
|
|
4332
|
-
* }
|
|
4333
|
-
*
|
|
4334
|
-
* // use image url to set tray icon
|
|
4335
|
-
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
4336
|
-
*
|
|
4337
|
-
* // use base64 encoded string to set tray icon
|
|
4338
|
-
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
4339
|
-
*
|
|
4340
|
-
* // use a dataURL to set tray icon
|
|
4341
|
-
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
4342
|
-
* ```
|
|
4343
|
-
*/
|
|
4344
|
-
setTrayIcon(icon) {
|
|
4345
|
-
return this.wire
|
|
4346
|
-
.sendAction('set-tray-icon', {
|
|
4347
|
-
enabledIcon: icon,
|
|
4348
|
-
...this.identity
|
|
4349
|
-
})
|
|
4350
|
-
.then(() => undefined);
|
|
4351
|
-
}
|
|
4352
|
-
/**
|
|
4353
|
-
* Set hover text for this application's system tray icon.
|
|
4354
|
-
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
|
4355
|
-
* @param toolTip
|
|
4356
|
-
*
|
|
4357
|
-
* @example
|
|
4358
|
-
*
|
|
4359
|
-
* ```js
|
|
4360
|
-
* const app = fin.Application.getCurrentSync();
|
|
4361
|
-
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
4362
|
-
*
|
|
4363
|
-
* await app.setTrayIcon(iconUrl);
|
|
4364
|
-
*
|
|
4365
|
-
* await app.setTrayIconToolTip('My Application');
|
|
4366
|
-
* ```
|
|
4367
|
-
*/
|
|
4368
|
-
async setTrayIconToolTip(toolTip) {
|
|
4369
|
-
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
|
4370
|
-
}
|
|
4371
|
-
/**
|
|
4372
|
-
* Sets new application's shortcut configuration. Windows only.
|
|
4373
|
-
* @param config New application's shortcut configuration.
|
|
4374
|
-
*
|
|
4375
|
-
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
4376
|
-
* to be able to change shortcut states.
|
|
4377
|
-
*
|
|
4378
|
-
* @example
|
|
4379
|
-
*
|
|
4380
|
-
* ```js
|
|
4381
|
-
* async function setShortcuts(config) {
|
|
4382
|
-
* const app = await fin.Application.getCurrent();
|
|
4383
|
-
* return app.setShortcuts(config);
|
|
4384
|
-
* }
|
|
4385
|
-
*
|
|
4386
|
-
* setShortcuts({
|
|
4387
|
-
* desktop: true,
|
|
4388
|
-
* startMenu: false,
|
|
4389
|
-
* systemStartup: true
|
|
4390
|
-
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
4391
|
-
* ```
|
|
4392
|
-
*/
|
|
4393
|
-
setShortcuts(config) {
|
|
4394
|
-
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
4395
|
-
}
|
|
4396
|
-
/**
|
|
4397
|
-
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
4398
|
-
* @param queryString The new query string for this app's shortcuts.
|
|
4399
|
-
*
|
|
4400
|
-
* @example
|
|
4401
|
-
*
|
|
4402
|
-
* ```js
|
|
4403
|
-
* const newQueryArgs = 'arg=true&arg2=false';
|
|
4404
|
-
* const app = await fin.Application.getCurrent();
|
|
4405
|
-
* try {
|
|
4406
|
-
* await app.setShortcutQueryParams(newQueryArgs);
|
|
4407
|
-
* } catch(err) {
|
|
4408
|
-
* console.error(err)
|
|
4409
|
-
* }
|
|
4410
|
-
* ```
|
|
4411
|
-
*/
|
|
4412
|
-
async setShortcutQueryParams(queryString) {
|
|
4413
|
-
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
4414
|
-
}
|
|
4415
|
-
/**
|
|
4416
|
-
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
4417
|
-
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
4418
|
-
* @param level The zoom level
|
|
4419
|
-
*
|
|
4420
|
-
* @example
|
|
4421
|
-
*
|
|
4422
|
-
* ```js
|
|
4423
|
-
* async function setZoomLevel(number) {
|
|
4424
|
-
* const app = await fin.Application.getCurrent();
|
|
4425
|
-
* return await app.setZoomLevel(number);
|
|
4426
|
-
* }
|
|
4427
|
-
*
|
|
4428
|
-
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
4429
|
-
* ```
|
|
4430
|
-
*/
|
|
4431
|
-
setZoomLevel(level) {
|
|
4432
|
-
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
4433
|
-
}
|
|
4434
|
-
/**
|
|
4435
|
-
* Sets a username to correlate with App Log Management.
|
|
4436
|
-
* @param username Username to correlate with App's Log.
|
|
4437
|
-
*
|
|
4438
|
-
* @example
|
|
4439
|
-
*
|
|
4440
|
-
* ```js
|
|
4441
|
-
* async function setAppLogUser() {
|
|
4442
|
-
* const app = await fin.Application.getCurrent();
|
|
4443
|
-
* return await app.setAppLogUsername('username');
|
|
4444
|
-
* }
|
|
4445
|
-
*
|
|
4446
|
-
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
4447
|
-
*
|
|
4448
|
-
* ```
|
|
4449
|
-
*/
|
|
4450
|
-
async setAppLogUsername(username) {
|
|
4451
|
-
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
4452
|
-
}
|
|
4453
|
-
/**
|
|
4454
|
-
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
4455
|
-
* @remarks The only information currently returned is the position and dimensions.
|
|
4456
|
-
*
|
|
4457
|
-
* @example
|
|
4458
|
-
*
|
|
4459
|
-
* ```js
|
|
4460
|
-
* async function getTrayIconInfo() {
|
|
4461
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
4462
|
-
* return await app.getTrayIconInfo();
|
|
4463
|
-
* }
|
|
4464
|
-
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
4465
|
-
* ```
|
|
4466
|
-
*/
|
|
4467
|
-
getTrayIconInfo() {
|
|
4468
|
-
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
4469
|
-
}
|
|
4470
|
-
/**
|
|
4471
|
-
* Checks if the application has an associated tray icon.
|
|
4472
|
-
*
|
|
4473
|
-
* @example
|
|
4474
|
-
*
|
|
4475
|
-
* ```js
|
|
4476
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
4477
|
-
* const hasTrayIcon = await app.hasTrayIcon();
|
|
4478
|
-
* console.log(hasTrayIcon);
|
|
4479
|
-
* ```
|
|
4480
|
-
*/
|
|
4481
|
-
hasTrayIcon() {
|
|
4482
|
-
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
4483
|
-
}
|
|
4484
|
-
/**
|
|
4485
|
-
* Closes the application by terminating its process.
|
|
4486
|
-
*
|
|
4487
|
-
* @example
|
|
4488
|
-
*
|
|
4489
|
-
* ```js
|
|
4490
|
-
* async function terminateApp() {
|
|
4491
|
-
* const app = await fin.Application.getCurrent();
|
|
4492
|
-
* return await app.terminate();
|
|
4493
|
-
* }
|
|
4494
|
-
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
4495
|
-
* ```
|
|
4496
|
-
*/
|
|
4497
|
-
terminate() {
|
|
4498
|
-
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
4499
|
-
}
|
|
4500
|
-
/**
|
|
4501
|
-
* Waits for a hanging application. This method can be called in response to an application
|
|
4502
|
-
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
4503
|
-
* message after a certain period of time.
|
|
4504
|
-
*
|
|
4505
|
-
* @ignore
|
|
4506
|
-
*/
|
|
4507
|
-
wait() {
|
|
4508
|
-
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
4509
|
-
}
|
|
4510
|
-
/**
|
|
4511
|
-
* Retrieves information about the application.
|
|
4512
|
-
*
|
|
4513
|
-
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
4514
|
-
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
4515
|
-
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
4516
|
-
*
|
|
4517
|
-
* @example
|
|
4518
|
-
*
|
|
4519
|
-
* ```js
|
|
4520
|
-
* async function getInfo() {
|
|
4521
|
-
* const app = await fin.Application.getCurrent();
|
|
4522
|
-
* return await app.getInfo();
|
|
4523
|
-
* }
|
|
4524
|
-
*
|
|
4525
|
-
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
4526
|
-
* ```
|
|
4527
|
-
*/
|
|
4528
|
-
getInfo() {
|
|
4529
|
-
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
4530
|
-
}
|
|
4531
|
-
/**
|
|
4532
|
-
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
4533
|
-
*
|
|
4534
|
-
* @example
|
|
4535
|
-
* ```js
|
|
4536
|
-
* const app = await fin.Application.getCurrent();
|
|
4537
|
-
* const processInfo = await app.getProcessInfo();
|
|
4538
|
-
* ```
|
|
4539
|
-
* @experimental
|
|
4540
|
-
*/
|
|
4541
|
-
async getProcessInfo() {
|
|
4542
|
-
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
4543
|
-
return data;
|
|
4544
|
-
}
|
|
4545
|
-
/**
|
|
4546
|
-
* Sets file auto download location. It's only allowed in the same application.
|
|
4547
|
-
*
|
|
4548
|
-
* Note: This method is restricted by default and must be enabled via
|
|
4549
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
4550
|
-
* @param downloadLocation file auto download location
|
|
4551
|
-
*
|
|
4552
|
-
* @throws if setting file auto download location on different applications.
|
|
4553
|
-
* @example
|
|
4554
|
-
*
|
|
4555
|
-
* ```js
|
|
4556
|
-
* const downloadLocation = 'C:\\dev\\temp';
|
|
4557
|
-
* const app = await fin.Application.getCurrent();
|
|
4558
|
-
* try {
|
|
4559
|
-
* await app.setFileDownloadLocation(downloadLocation);
|
|
4560
|
-
* console.log('File download location is set');
|
|
4561
|
-
* } catch(err) {
|
|
4562
|
-
* console.error(err)
|
|
4563
|
-
* }
|
|
4564
|
-
* ```
|
|
4565
|
-
*/
|
|
4566
|
-
async setFileDownloadLocation(downloadLocation) {
|
|
4567
|
-
const { name } = this.wire.me;
|
|
4568
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
4569
|
-
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
4570
|
-
}
|
|
4571
|
-
/**
|
|
4572
|
-
* Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
|
|
4573
|
-
*
|
|
4574
|
-
* Note: This method is restricted by default and must be enabled via
|
|
4575
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
4576
|
-
*
|
|
4577
|
-
* @throws if getting file auto download location on different applications.
|
|
4578
|
-
* @example
|
|
4579
|
-
*
|
|
4580
|
-
* ```js
|
|
4581
|
-
* const app = await fin.Application.getCurrent();
|
|
4582
|
-
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
4583
|
-
* ```
|
|
4584
|
-
*/
|
|
4585
|
-
async getFileDownloadLocation() {
|
|
4586
|
-
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
4587
|
-
return data;
|
|
4588
|
-
}
|
|
4589
|
-
/**
|
|
4590
|
-
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
|
4591
|
-
* @param options
|
|
4592
|
-
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
|
4593
|
-
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
|
4594
|
-
* of all possible data shapes for the entire menu, and the click handler should process
|
|
4595
|
-
* these with a "reducer" pattern.
|
|
4596
|
-
* @throws if the application has no tray icon set
|
|
4597
|
-
* @throws if the system tray is currently hidden
|
|
4598
|
-
* @example
|
|
4599
|
-
*
|
|
4600
|
-
* ```js
|
|
4601
|
-
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
|
4602
|
-
* const app = fin.Application.getCurrentSync();
|
|
4603
|
-
*
|
|
4604
|
-
* await app.setTrayIcon(iconUrl);
|
|
4605
|
-
*
|
|
4606
|
-
* const template = [
|
|
4607
|
-
* {
|
|
4608
|
-
* label: 'Menu Item 1',
|
|
4609
|
-
* data: 'hello from item 1'
|
|
4610
|
-
* },
|
|
4611
|
-
* { type: 'separator' },
|
|
4612
|
-
* {
|
|
4613
|
-
* label: 'Menu Item 2',
|
|
4614
|
-
* type: 'checkbox',
|
|
4615
|
-
* checked: true,
|
|
4616
|
-
* data: 'The user clicked the checkbox'
|
|
4617
|
-
* },
|
|
4618
|
-
* {
|
|
4619
|
-
* label: 'see more',
|
|
4620
|
-
* enabled: false,
|
|
4621
|
-
* submenu: [
|
|
4622
|
-
* { label: 'submenu 1', data: 'hello from submenu' }
|
|
4623
|
-
* ]
|
|
4624
|
-
* }
|
|
4625
|
-
* ];
|
|
4626
|
-
*
|
|
4627
|
-
* app.addListener('tray-icon-clicked', (event) => {
|
|
4628
|
-
* // right-click
|
|
4629
|
-
* if (event.button === 2) {
|
|
4630
|
-
* app.showTrayIconPopupMenu({ template }).then(r => {
|
|
4631
|
-
* if (r.result === 'closed') {
|
|
4632
|
-
* console.log('nothing happened');
|
|
4633
|
-
* } else {
|
|
4634
|
-
* console.log(r.data);
|
|
4635
|
-
* }
|
|
4636
|
-
* });
|
|
4637
|
-
* }
|
|
4638
|
-
* });
|
|
4639
|
-
* ```
|
|
4640
|
-
*/
|
|
4641
|
-
async showTrayIconPopupMenu(options) {
|
|
4642
|
-
const { name } = this.wire.me;
|
|
4643
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
4644
|
-
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
|
4645
|
-
return payload.data;
|
|
4646
|
-
}
|
|
4647
|
-
/**
|
|
4648
|
-
* Closes the tray icon menu.
|
|
4649
|
-
*
|
|
4650
|
-
* @throws if the application has no tray icon set
|
|
4651
|
-
* @example
|
|
4652
|
-
*
|
|
4653
|
-
* ```js
|
|
4654
|
-
* const app = fin.Application.getCurrentSync();
|
|
4655
|
-
*
|
|
4656
|
-
* await app.closeTrayIconPopupMenu();
|
|
4657
|
-
* ```
|
|
4658
|
-
*/
|
|
4659
|
-
async closeTrayIconPopupMenu() {
|
|
4660
|
-
const { name } = this.wire.me;
|
|
4661
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
4662
|
-
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
4663
|
-
}
|
|
4664
|
-
}
|
|
4665
|
-
Instance$5.Application = Application;
|
|
3843
|
+
var hasRequiredInstance$2;
|
|
4666
3844
|
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
3845
|
+
function requireInstance$2 () {
|
|
3846
|
+
if (hasRequiredInstance$2) return Instance$5;
|
|
3847
|
+
hasRequiredInstance$2 = 1;
|
|
3848
|
+
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
|
3849
|
+
Instance$5.Application = void 0;
|
|
3850
|
+
/* eslint-disable import/prefer-default-export */
|
|
3851
|
+
const base_1 = base;
|
|
3852
|
+
const window_1 = requireWindow();
|
|
3853
|
+
const view_1 = requireView();
|
|
3854
|
+
/**
|
|
3855
|
+
* An object representing an application. Allows the developer to create,
|
|
3856
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
3857
|
+
*/
|
|
3858
|
+
class Application extends base_1.EmitterBase {
|
|
3859
|
+
/**
|
|
3860
|
+
* @internal
|
|
3861
|
+
*/
|
|
3862
|
+
constructor(wire, identity) {
|
|
3863
|
+
super(wire, 'application', identity.uuid);
|
|
3864
|
+
this.identity = identity;
|
|
3865
|
+
this.window = new window_1._Window(this.wire, {
|
|
3866
|
+
uuid: this.identity.uuid,
|
|
3867
|
+
name: this.identity.uuid
|
|
3868
|
+
});
|
|
3869
|
+
}
|
|
3870
|
+
windowListFromIdentityList(identityList) {
|
|
3871
|
+
const windowList = [];
|
|
3872
|
+
identityList.forEach((identity) => {
|
|
3873
|
+
windowList.push(new window_1._Window(this.wire, {
|
|
3874
|
+
uuid: identity.uuid,
|
|
3875
|
+
name: identity.name
|
|
3876
|
+
}));
|
|
3877
|
+
});
|
|
3878
|
+
return windowList;
|
|
3879
|
+
}
|
|
3880
|
+
/**
|
|
3881
|
+
* Determines if the application is currently running.
|
|
3882
|
+
*
|
|
3883
|
+
* @example
|
|
3884
|
+
*
|
|
3885
|
+
* ```js
|
|
3886
|
+
* async function isAppRunning() {
|
|
3887
|
+
* const app = await fin.Application.getCurrent();
|
|
3888
|
+
* return await app.isRunning();
|
|
3889
|
+
* }
|
|
3890
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
3891
|
+
* ```
|
|
3892
|
+
*/
|
|
3893
|
+
isRunning() {
|
|
3894
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
3895
|
+
}
|
|
3896
|
+
/**
|
|
3897
|
+
* Closes the application and any child windows created by the application.
|
|
3898
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
3899
|
+
* @param force Close will be prevented from closing when force is false and
|
|
3900
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
3901
|
+
*
|
|
3902
|
+
* @example
|
|
3903
|
+
*
|
|
3904
|
+
* ```js
|
|
3905
|
+
* async function closeApp() {
|
|
3906
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
3907
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
3908
|
+
* await app.quit();
|
|
3909
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
3910
|
+
*
|
|
3911
|
+
* }
|
|
3912
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
3913
|
+
* ```
|
|
3914
|
+
*/
|
|
3915
|
+
async quit(force = false) {
|
|
3916
|
+
try {
|
|
3917
|
+
await this._close(force);
|
|
3918
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
3919
|
+
}
|
|
3920
|
+
catch (error) {
|
|
3921
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
3922
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
3923
|
+
throw error;
|
|
3924
|
+
}
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
async _close(force = false) {
|
|
3928
|
+
try {
|
|
3929
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
3930
|
+
}
|
|
3931
|
+
catch (error) {
|
|
3932
|
+
if (!error.message.includes('Remote connection has closed')) {
|
|
3933
|
+
throw error;
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* @deprecated use Application.quit instead
|
|
3939
|
+
* Closes the application and any child windows created by the application.
|
|
3940
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
3941
|
+
* @param callback - called if the method succeeds.
|
|
3942
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
3943
|
+
*
|
|
3944
|
+
* @example
|
|
3945
|
+
*
|
|
3946
|
+
* ```js
|
|
3947
|
+
* async function closeApp() {
|
|
3948
|
+
* const app = await fin.Application.getCurrent();
|
|
3949
|
+
* return await app.close();
|
|
3950
|
+
* }
|
|
3951
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
3952
|
+
* ```
|
|
3953
|
+
*/
|
|
3954
|
+
close(force = false) {
|
|
3955
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
3956
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
|
3957
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3958
|
+
});
|
|
3959
|
+
return this._close(force);
|
|
3960
|
+
}
|
|
3961
|
+
/**
|
|
3962
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
3963
|
+
*
|
|
3964
|
+
* @example
|
|
3965
|
+
*
|
|
3966
|
+
* ```js
|
|
3967
|
+
* async function getChildWindows() {
|
|
3968
|
+
* const app = await fin.Application.getCurrent();
|
|
3969
|
+
* return await app.getChildWindows();
|
|
3970
|
+
* }
|
|
3971
|
+
*
|
|
3972
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
3973
|
+
* ```
|
|
3974
|
+
*/
|
|
3975
|
+
getChildWindows() {
|
|
3976
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
3977
|
+
const identityList = [];
|
|
3978
|
+
payload.data.forEach((winName) => {
|
|
3979
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
3980
|
+
});
|
|
3981
|
+
return this.windowListFromIdentityList(identityList);
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
/**
|
|
3985
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
3986
|
+
* if the application was not created from a manifest.
|
|
3987
|
+
*
|
|
3988
|
+
* @example
|
|
3989
|
+
*
|
|
3990
|
+
* ```js
|
|
3991
|
+
* async function getManifest() {
|
|
3992
|
+
* const app = await fin.Application.getCurrent();
|
|
3993
|
+
* return await app.getManifest();
|
|
3994
|
+
* }
|
|
3995
|
+
*
|
|
3996
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
3997
|
+
* ```
|
|
3998
|
+
*/
|
|
3999
|
+
getManifest() {
|
|
4000
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
4001
|
+
}
|
|
4002
|
+
/**
|
|
4003
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
4004
|
+
* if the application was created from a manifest.
|
|
4005
|
+
*
|
|
4006
|
+
* @example
|
|
4007
|
+
*
|
|
4008
|
+
* ```js
|
|
4009
|
+
* async function getParentUuid() {
|
|
4010
|
+
* const app = await fin.Application.start({
|
|
4011
|
+
* uuid: 'app-1',
|
|
4012
|
+
* name: 'myApp',
|
|
4013
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
4014
|
+
* autoShow: true
|
|
4015
|
+
* });
|
|
4016
|
+
* return await app.getParentUuid();
|
|
4017
|
+
* }
|
|
4018
|
+
*
|
|
4019
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
4020
|
+
* ```
|
|
4021
|
+
*/
|
|
4022
|
+
getParentUuid() {
|
|
4023
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
4024
|
+
}
|
|
4025
|
+
/**
|
|
4026
|
+
* Retrieves current application's shortcut configuration.
|
|
4027
|
+
*
|
|
4028
|
+
* @example
|
|
4029
|
+
*
|
|
4030
|
+
* ```js
|
|
4031
|
+
* async function getShortcuts() {
|
|
4032
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
4033
|
+
* return await app.getShortcuts();
|
|
4034
|
+
* }
|
|
4035
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
4036
|
+
* ```
|
|
4037
|
+
*/
|
|
4038
|
+
getShortcuts() {
|
|
4039
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
4040
|
+
}
|
|
4041
|
+
/**
|
|
4042
|
+
* Retrieves current application's views.
|
|
4043
|
+
* @experimental
|
|
4044
|
+
*
|
|
4045
|
+
* @example
|
|
4046
|
+
*
|
|
4047
|
+
* ```js
|
|
4048
|
+
* async function getViews() {
|
|
4049
|
+
* const app = await fin.Application.getCurrent();
|
|
4050
|
+
* return await app.getViews();
|
|
4051
|
+
* }
|
|
4052
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
4053
|
+
* ```
|
|
4054
|
+
*/
|
|
4055
|
+
async getViews() {
|
|
4056
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
4057
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
4058
|
+
}
|
|
4059
|
+
/**
|
|
4060
|
+
* Returns the current zoom level of the application.
|
|
4061
|
+
*
|
|
4062
|
+
* @example
|
|
4063
|
+
*
|
|
4064
|
+
* ```js
|
|
4065
|
+
* async function getZoomLevel() {
|
|
4066
|
+
* const app = await fin.Application.getCurrent();
|
|
4067
|
+
* return await app.getZoomLevel();
|
|
4068
|
+
* }
|
|
4069
|
+
*
|
|
4070
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
4071
|
+
* ```
|
|
4072
|
+
*/
|
|
4073
|
+
getZoomLevel() {
|
|
4074
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
4075
|
+
}
|
|
4076
|
+
/**
|
|
4077
|
+
* Returns an instance of the main Window of the application
|
|
4078
|
+
*
|
|
4079
|
+
* @example
|
|
4080
|
+
*
|
|
4081
|
+
* ```js
|
|
4082
|
+
* async function getWindow() {
|
|
4083
|
+
* const app = await fin.Application.start({
|
|
4084
|
+
* uuid: 'app-1',
|
|
4085
|
+
* name: 'myApp',
|
|
4086
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
4087
|
+
* autoShow: true
|
|
4088
|
+
* });
|
|
4089
|
+
* return await app.getWindow();
|
|
4090
|
+
* }
|
|
4091
|
+
*
|
|
4092
|
+
* getWindow().then(win => {
|
|
4093
|
+
* win.showAt(0, 400);
|
|
4094
|
+
* win.flash();
|
|
4095
|
+
* }).catch(err => console.log(err));
|
|
4096
|
+
* ```
|
|
4097
|
+
*/
|
|
4098
|
+
getWindow() {
|
|
4099
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
|
4100
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4101
|
+
});
|
|
4102
|
+
return Promise.resolve(this.window);
|
|
4103
|
+
}
|
|
4104
|
+
/**
|
|
4105
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
4106
|
+
* @param userName - username to be passed to the RVM.
|
|
4107
|
+
* @param appName - app name to be passed to the RVM.
|
|
4108
|
+
*
|
|
4109
|
+
* @example
|
|
4110
|
+
*
|
|
4111
|
+
* ```js
|
|
4112
|
+
* async function registerUser() {
|
|
4113
|
+
* const app = await fin.Application.getCurrent();
|
|
4114
|
+
* return await app.registerUser('user', 'myApp');
|
|
4115
|
+
* }
|
|
4116
|
+
*
|
|
4117
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
4118
|
+
* ```
|
|
4119
|
+
*/
|
|
4120
|
+
registerUser(userName, appName) {
|
|
4121
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
4122
|
+
}
|
|
4123
|
+
/**
|
|
4124
|
+
* Removes the application’s icon from the tray.
|
|
4125
|
+
*
|
|
4126
|
+
* @example
|
|
4127
|
+
*
|
|
4128
|
+
* ```js
|
|
4129
|
+
* async function removeTrayIcon() {
|
|
4130
|
+
* const app = await fin.Application.getCurrent();
|
|
4131
|
+
* return await app.removeTrayIcon();
|
|
4132
|
+
* }
|
|
4133
|
+
*
|
|
4134
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
4135
|
+
* ```
|
|
4136
|
+
*/
|
|
4137
|
+
removeTrayIcon() {
|
|
4138
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
4139
|
+
}
|
|
4140
|
+
/**
|
|
4141
|
+
* Restarts the application.
|
|
4142
|
+
*
|
|
4143
|
+
* @example
|
|
4144
|
+
*
|
|
4145
|
+
* ```js
|
|
4146
|
+
* async function restartApp() {
|
|
4147
|
+
* const app = await fin.Application.getCurrent();
|
|
4148
|
+
* return await app.restart();
|
|
4149
|
+
* }
|
|
4150
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
4151
|
+
* ```
|
|
4152
|
+
*/
|
|
4153
|
+
restart() {
|
|
4154
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
4155
|
+
}
|
|
4156
|
+
/**
|
|
4157
|
+
* DEPRECATED method to run the application.
|
|
4158
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
4159
|
+
*
|
|
4160
|
+
* @example
|
|
4161
|
+
*
|
|
4162
|
+
* ```js
|
|
4163
|
+
* async function run() {
|
|
4164
|
+
* const app = await fin.Application.create({
|
|
4165
|
+
* name: 'myApp',
|
|
4166
|
+
* uuid: 'app-1',
|
|
4167
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
4168
|
+
* autoShow: true
|
|
4169
|
+
* });
|
|
4170
|
+
* await app.run();
|
|
4171
|
+
* }
|
|
4172
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
4173
|
+
* ```
|
|
4174
|
+
*
|
|
4175
|
+
* @ignore
|
|
4176
|
+
*/
|
|
4177
|
+
run() {
|
|
4178
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
4179
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
|
4180
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4181
|
+
});
|
|
4182
|
+
return this._run();
|
|
4183
|
+
}
|
|
4184
|
+
_run(opts = {}) {
|
|
4185
|
+
return this.wire
|
|
4186
|
+
.sendAction('run-application', {
|
|
4187
|
+
manifestUrl: this._manifestUrl,
|
|
4188
|
+
opts,
|
|
4189
|
+
...this.identity
|
|
4190
|
+
})
|
|
4191
|
+
.then(() => undefined);
|
|
4192
|
+
}
|
|
4193
|
+
/**
|
|
4194
|
+
* Instructs the RVM to schedule one restart of the application.
|
|
4195
|
+
*
|
|
4196
|
+
* @example
|
|
4197
|
+
*
|
|
4198
|
+
* ```js
|
|
4199
|
+
* async function scheduleRestart() {
|
|
4200
|
+
* const app = await fin.Application.getCurrent();
|
|
4201
|
+
* return await app.scheduleRestart();
|
|
4202
|
+
* }
|
|
4203
|
+
*
|
|
4204
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
4205
|
+
* ```
|
|
4206
|
+
*/
|
|
4207
|
+
scheduleRestart() {
|
|
4208
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
4209
|
+
}
|
|
4210
|
+
/**
|
|
4211
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
|
4212
|
+
* an object containing logId is returned.
|
|
4213
|
+
*
|
|
4214
|
+
* @example
|
|
4215
|
+
*
|
|
4216
|
+
* ```js
|
|
4217
|
+
* async function sendLog() {
|
|
4218
|
+
* const app = await fin.Application.getCurrent();
|
|
4219
|
+
* return await app.sendApplicationLog();
|
|
4220
|
+
* }
|
|
4221
|
+
*
|
|
4222
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
4223
|
+
* ```
|
|
4224
|
+
*/
|
|
4225
|
+
async sendApplicationLog() {
|
|
4226
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
4227
|
+
return payload.data;
|
|
4228
|
+
}
|
|
4229
|
+
/**
|
|
4230
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
4231
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
4232
|
+
*
|
|
4233
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
4234
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
4235
|
+
*
|
|
4236
|
+
*
|
|
4237
|
+
* @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
4238
|
+
*
|
|
4239
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
4240
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
4241
|
+
*
|
|
4242
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
4243
|
+
*
|
|
4244
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
4245
|
+
* uuid or shortcut.name is changed.
|
|
4246
|
+
*
|
|
4247
|
+
* @example
|
|
4248
|
+
*
|
|
4249
|
+
* ```js
|
|
4250
|
+
* const app = fin.Application.getCurrentSync();
|
|
4251
|
+
* const appName = 'My App';
|
|
4252
|
+
* const jumpListConfig = [ // array of JumpList categories
|
|
4253
|
+
* {
|
|
4254
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
|
4255
|
+
* items: [ // array of JumpList items
|
|
4256
|
+
* {
|
|
4257
|
+
* type: 'task',
|
|
4258
|
+
* title: `Launch ${appName}`,
|
|
4259
|
+
* description: `Runs ${appName} with the default configuration`,
|
|
4260
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
|
4261
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
4262
|
+
* iconIndex: 0
|
|
4263
|
+
* },
|
|
4264
|
+
* { type: 'separator' },
|
|
4265
|
+
* {
|
|
4266
|
+
* type: 'task',
|
|
4267
|
+
* title: `Restore ${appName}`,
|
|
4268
|
+
* description: 'Restore to last configuration',
|
|
4269
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
4270
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
4271
|
+
* iconIndex: 0
|
|
4272
|
+
* },
|
|
4273
|
+
* ]
|
|
4274
|
+
* },
|
|
4275
|
+
* {
|
|
4276
|
+
* name: 'Tools',
|
|
4277
|
+
* items: [ // array of JumpList items
|
|
4278
|
+
* {
|
|
4279
|
+
* type: 'task',
|
|
4280
|
+
* title: 'Tool A',
|
|
4281
|
+
* description: 'Runs Tool A',
|
|
4282
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
4283
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
4284
|
+
* iconIndex: 0
|
|
4285
|
+
* },
|
|
4286
|
+
* {
|
|
4287
|
+
* type: 'task',
|
|
4288
|
+
* title: 'Tool B',
|
|
4289
|
+
* description: 'Runs Tool B',
|
|
4290
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
4291
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
4292
|
+
* iconIndex: 0
|
|
4293
|
+
* }]
|
|
4294
|
+
* }
|
|
4295
|
+
* ];
|
|
4296
|
+
*
|
|
4297
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
4298
|
+
* ```
|
|
4299
|
+
*
|
|
4300
|
+
* To handle deeplink args:
|
|
4301
|
+
* ```js
|
|
4302
|
+
* function handleUseLastConfiguration() {
|
|
4303
|
+
* // this handler is called when the app is being launched
|
|
4304
|
+
* app.on('run-requested', event => {
|
|
4305
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
4306
|
+
* // your logic here
|
|
4307
|
+
* }
|
|
4308
|
+
* });
|
|
4309
|
+
* // this handler is called when the app was already running when the launch was requested
|
|
4310
|
+
* fin.desktop.main(function(args) {
|
|
4311
|
+
* if(args && args['use-last-configuration']) {
|
|
4312
|
+
* // your logic here
|
|
4313
|
+
* }
|
|
4314
|
+
* });
|
|
4315
|
+
* }
|
|
4316
|
+
* ```
|
|
4317
|
+
*/
|
|
4318
|
+
async setJumpList(jumpListCategories) {
|
|
4319
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
4320
|
+
}
|
|
4321
|
+
/**
|
|
4322
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
4323
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
4324
|
+
*
|
|
4325
|
+
* @example
|
|
4326
|
+
*
|
|
4327
|
+
* ```js
|
|
4328
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
4329
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
4330
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
4331
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
4332
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
4333
|
+
*
|
|
4334
|
+
* async function setTrayIcon(icon) {
|
|
4335
|
+
* const app = await fin.Application.getCurrent();
|
|
4336
|
+
* return await app.setTrayIcon(icon);
|
|
4337
|
+
* }
|
|
4338
|
+
*
|
|
4339
|
+
* // use image url to set tray icon
|
|
4340
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
4341
|
+
*
|
|
4342
|
+
* // use base64 encoded string to set tray icon
|
|
4343
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
4344
|
+
*
|
|
4345
|
+
* // use a dataURL to set tray icon
|
|
4346
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
4347
|
+
* ```
|
|
4348
|
+
*/
|
|
4349
|
+
setTrayIcon(icon) {
|
|
4350
|
+
return this.wire
|
|
4351
|
+
.sendAction('set-tray-icon', {
|
|
4352
|
+
enabledIcon: icon,
|
|
4353
|
+
...this.identity
|
|
4354
|
+
})
|
|
4355
|
+
.then(() => undefined);
|
|
4356
|
+
}
|
|
4357
|
+
/**
|
|
4358
|
+
* Set hover text for this application's system tray icon.
|
|
4359
|
+
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
|
4360
|
+
* @param toolTip
|
|
4361
|
+
*
|
|
4362
|
+
* @example
|
|
4363
|
+
*
|
|
4364
|
+
* ```js
|
|
4365
|
+
* const app = fin.Application.getCurrentSync();
|
|
4366
|
+
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
4367
|
+
*
|
|
4368
|
+
* await app.setTrayIcon(iconUrl);
|
|
4369
|
+
*
|
|
4370
|
+
* await app.setTrayIconToolTip('My Application');
|
|
4371
|
+
* ```
|
|
4372
|
+
*/
|
|
4373
|
+
async setTrayIconToolTip(toolTip) {
|
|
4374
|
+
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
|
4375
|
+
}
|
|
4376
|
+
/**
|
|
4377
|
+
* Sets new application's shortcut configuration. Windows only.
|
|
4378
|
+
* @param config New application's shortcut configuration.
|
|
4379
|
+
*
|
|
4380
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
4381
|
+
* to be able to change shortcut states.
|
|
4382
|
+
*
|
|
4383
|
+
* @example
|
|
4384
|
+
*
|
|
4385
|
+
* ```js
|
|
4386
|
+
* async function setShortcuts(config) {
|
|
4387
|
+
* const app = await fin.Application.getCurrent();
|
|
4388
|
+
* return app.setShortcuts(config);
|
|
4389
|
+
* }
|
|
4390
|
+
*
|
|
4391
|
+
* setShortcuts({
|
|
4392
|
+
* desktop: true,
|
|
4393
|
+
* startMenu: false,
|
|
4394
|
+
* systemStartup: true
|
|
4395
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
4396
|
+
* ```
|
|
4397
|
+
*/
|
|
4398
|
+
setShortcuts(config) {
|
|
4399
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
4400
|
+
}
|
|
4401
|
+
/**
|
|
4402
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
4403
|
+
* @param queryString The new query string for this app's shortcuts.
|
|
4404
|
+
*
|
|
4405
|
+
* @example
|
|
4406
|
+
*
|
|
4407
|
+
* ```js
|
|
4408
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
|
4409
|
+
* const app = await fin.Application.getCurrent();
|
|
4410
|
+
* try {
|
|
4411
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
|
4412
|
+
* } catch(err) {
|
|
4413
|
+
* console.error(err)
|
|
4414
|
+
* }
|
|
4415
|
+
* ```
|
|
4416
|
+
*/
|
|
4417
|
+
async setShortcutQueryParams(queryString) {
|
|
4418
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
4419
|
+
}
|
|
4420
|
+
/**
|
|
4421
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
4422
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
4423
|
+
* @param level The zoom level
|
|
4424
|
+
*
|
|
4425
|
+
* @example
|
|
4426
|
+
*
|
|
4427
|
+
* ```js
|
|
4428
|
+
* async function setZoomLevel(number) {
|
|
4429
|
+
* const app = await fin.Application.getCurrent();
|
|
4430
|
+
* return await app.setZoomLevel(number);
|
|
4431
|
+
* }
|
|
4432
|
+
*
|
|
4433
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
4434
|
+
* ```
|
|
4435
|
+
*/
|
|
4436
|
+
setZoomLevel(level) {
|
|
4437
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
4438
|
+
}
|
|
4439
|
+
/**
|
|
4440
|
+
* Sets a username to correlate with App Log Management.
|
|
4441
|
+
* @param username Username to correlate with App's Log.
|
|
4442
|
+
*
|
|
4443
|
+
* @example
|
|
4444
|
+
*
|
|
4445
|
+
* ```js
|
|
4446
|
+
* async function setAppLogUser() {
|
|
4447
|
+
* const app = await fin.Application.getCurrent();
|
|
4448
|
+
* return await app.setAppLogUsername('username');
|
|
4449
|
+
* }
|
|
4450
|
+
*
|
|
4451
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
4452
|
+
*
|
|
4453
|
+
* ```
|
|
4454
|
+
*/
|
|
4455
|
+
async setAppLogUsername(username) {
|
|
4456
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
4457
|
+
}
|
|
4458
|
+
/**
|
|
4459
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
4460
|
+
* @remarks The only information currently returned is the position and dimensions.
|
|
4461
|
+
*
|
|
4462
|
+
* @example
|
|
4463
|
+
*
|
|
4464
|
+
* ```js
|
|
4465
|
+
* async function getTrayIconInfo() {
|
|
4466
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
4467
|
+
* return await app.getTrayIconInfo();
|
|
4468
|
+
* }
|
|
4469
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
4470
|
+
* ```
|
|
4471
|
+
*/
|
|
4472
|
+
getTrayIconInfo() {
|
|
4473
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
4474
|
+
}
|
|
4475
|
+
/**
|
|
4476
|
+
* Checks if the application has an associated tray icon.
|
|
4477
|
+
*
|
|
4478
|
+
* @example
|
|
4479
|
+
*
|
|
4480
|
+
* ```js
|
|
4481
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
4482
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
|
4483
|
+
* console.log(hasTrayIcon);
|
|
4484
|
+
* ```
|
|
4485
|
+
*/
|
|
4486
|
+
hasTrayIcon() {
|
|
4487
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
4488
|
+
}
|
|
4489
|
+
/**
|
|
4490
|
+
* Closes the application by terminating its process.
|
|
4491
|
+
*
|
|
4492
|
+
* @example
|
|
4493
|
+
*
|
|
4494
|
+
* ```js
|
|
4495
|
+
* async function terminateApp() {
|
|
4496
|
+
* const app = await fin.Application.getCurrent();
|
|
4497
|
+
* return await app.terminate();
|
|
4498
|
+
* }
|
|
4499
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
4500
|
+
* ```
|
|
4501
|
+
*/
|
|
4502
|
+
terminate() {
|
|
4503
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
4504
|
+
}
|
|
4505
|
+
/**
|
|
4506
|
+
* Waits for a hanging application. This method can be called in response to an application
|
|
4507
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
4508
|
+
* message after a certain period of time.
|
|
4509
|
+
*
|
|
4510
|
+
* @ignore
|
|
4511
|
+
*/
|
|
4512
|
+
wait() {
|
|
4513
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
4514
|
+
}
|
|
4515
|
+
/**
|
|
4516
|
+
* Retrieves information about the application.
|
|
4517
|
+
*
|
|
4518
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
4519
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
4520
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
4521
|
+
*
|
|
4522
|
+
* @example
|
|
4523
|
+
*
|
|
4524
|
+
* ```js
|
|
4525
|
+
* async function getInfo() {
|
|
4526
|
+
* const app = await fin.Application.getCurrent();
|
|
4527
|
+
* return await app.getInfo();
|
|
4528
|
+
* }
|
|
4529
|
+
*
|
|
4530
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
4531
|
+
* ```
|
|
4532
|
+
*/
|
|
4533
|
+
getInfo() {
|
|
4534
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
4535
|
+
}
|
|
4536
|
+
/**
|
|
4537
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
4538
|
+
*
|
|
4539
|
+
* @example
|
|
4540
|
+
* ```js
|
|
4541
|
+
* const app = await fin.Application.getCurrent();
|
|
4542
|
+
* const processInfo = await app.getProcessInfo();
|
|
4543
|
+
* ```
|
|
4544
|
+
* @experimental
|
|
4545
|
+
*/
|
|
4546
|
+
async getProcessInfo() {
|
|
4547
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
4548
|
+
return data;
|
|
4549
|
+
}
|
|
4550
|
+
/**
|
|
4551
|
+
* Sets file auto download location. It's only allowed in the same application.
|
|
4552
|
+
*
|
|
4553
|
+
* Note: This method is restricted by default and must be enabled via
|
|
4554
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
4555
|
+
* @param downloadLocation file auto download location
|
|
4556
|
+
*
|
|
4557
|
+
* @throws if setting file auto download location on different applications.
|
|
4558
|
+
* @example
|
|
4559
|
+
*
|
|
4560
|
+
* ```js
|
|
4561
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
|
4562
|
+
* const app = await fin.Application.getCurrent();
|
|
4563
|
+
* try {
|
|
4564
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
|
4565
|
+
* console.log('File download location is set');
|
|
4566
|
+
* } catch(err) {
|
|
4567
|
+
* console.error(err)
|
|
4568
|
+
* }
|
|
4569
|
+
* ```
|
|
4570
|
+
*/
|
|
4571
|
+
async setFileDownloadLocation(downloadLocation) {
|
|
4572
|
+
const { name } = this.wire.me;
|
|
4573
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
4574
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
4575
|
+
}
|
|
4576
|
+
/**
|
|
4577
|
+
* Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
|
|
4578
|
+
*
|
|
4579
|
+
* Note: This method is restricted by default and must be enabled via
|
|
4580
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
4581
|
+
*
|
|
4582
|
+
* @throws if getting file auto download location on different applications.
|
|
4583
|
+
* @example
|
|
4584
|
+
*
|
|
4585
|
+
* ```js
|
|
4586
|
+
* const app = await fin.Application.getCurrent();
|
|
4587
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
4588
|
+
* ```
|
|
4589
|
+
*/
|
|
4590
|
+
async getFileDownloadLocation() {
|
|
4591
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
4592
|
+
return data;
|
|
4593
|
+
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
|
4596
|
+
* @param options
|
|
4597
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
|
4598
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
|
4599
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
|
4600
|
+
* these with a "reducer" pattern.
|
|
4601
|
+
* @throws if the application has no tray icon set
|
|
4602
|
+
* @throws if the system tray is currently hidden
|
|
4603
|
+
* @example
|
|
4604
|
+
*
|
|
4605
|
+
* ```js
|
|
4606
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
|
4607
|
+
* const app = fin.Application.getCurrentSync();
|
|
4608
|
+
*
|
|
4609
|
+
* await app.setTrayIcon(iconUrl);
|
|
4610
|
+
*
|
|
4611
|
+
* const template = [
|
|
4612
|
+
* {
|
|
4613
|
+
* label: 'Menu Item 1',
|
|
4614
|
+
* data: 'hello from item 1'
|
|
4615
|
+
* },
|
|
4616
|
+
* { type: 'separator' },
|
|
4617
|
+
* {
|
|
4618
|
+
* label: 'Menu Item 2',
|
|
4619
|
+
* type: 'checkbox',
|
|
4620
|
+
* checked: true,
|
|
4621
|
+
* data: 'The user clicked the checkbox'
|
|
4622
|
+
* },
|
|
4623
|
+
* {
|
|
4624
|
+
* label: 'see more',
|
|
4625
|
+
* enabled: false,
|
|
4626
|
+
* submenu: [
|
|
4627
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
|
4628
|
+
* ]
|
|
4629
|
+
* }
|
|
4630
|
+
* ];
|
|
4631
|
+
*
|
|
4632
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
|
4633
|
+
* // right-click
|
|
4634
|
+
* if (event.button === 2) {
|
|
4635
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
|
4636
|
+
* if (r.result === 'closed') {
|
|
4637
|
+
* console.log('nothing happened');
|
|
4638
|
+
* } else {
|
|
4639
|
+
* console.log(r.data);
|
|
4640
|
+
* }
|
|
4641
|
+
* });
|
|
4642
|
+
* }
|
|
4643
|
+
* });
|
|
4644
|
+
* ```
|
|
4645
|
+
*/
|
|
4646
|
+
async showTrayIconPopupMenu(options) {
|
|
4647
|
+
const { name } = this.wire.me;
|
|
4648
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
4649
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
|
4650
|
+
return payload.data;
|
|
4651
|
+
}
|
|
4652
|
+
/**
|
|
4653
|
+
* Closes the tray icon menu.
|
|
4654
|
+
*
|
|
4655
|
+
* @throws if the application has no tray icon set
|
|
4656
|
+
* @example
|
|
4657
|
+
*
|
|
4658
|
+
* ```js
|
|
4659
|
+
* const app = fin.Application.getCurrentSync();
|
|
4660
|
+
*
|
|
4661
|
+
* await app.closeTrayIconPopupMenu();
|
|
4662
|
+
* ```
|
|
4663
|
+
*/
|
|
4664
|
+
async closeTrayIconPopupMenu() {
|
|
4665
|
+
const { name } = this.wire.me;
|
|
4666
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
4667
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
Instance$5.Application = Application;
|
|
4671
|
+
return Instance$5;
|
|
4937
4672
|
}
|
|
4938
|
-
Factory$6.ApplicationModule = ApplicationModule;
|
|
4939
4673
|
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
o[k2] = m[k];
|
|
4951
|
-
}));
|
|
4952
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
4953
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4954
|
-
};
|
|
4955
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4674
|
+
var hasRequiredFactory$1;
|
|
4675
|
+
|
|
4676
|
+
function requireFactory$1 () {
|
|
4677
|
+
if (hasRequiredFactory$1) return Factory$6;
|
|
4678
|
+
hasRequiredFactory$1 = 1;
|
|
4679
|
+
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
|
4680
|
+
Factory$6.ApplicationModule = void 0;
|
|
4681
|
+
const base_1 = base;
|
|
4682
|
+
const validate_1 = validate;
|
|
4683
|
+
const Instance_1 = requireInstance$2();
|
|
4956
4684
|
/**
|
|
4957
|
-
*
|
|
4958
|
-
*
|
|
4959
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
4960
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
4961
|
-
*
|
|
4962
|
-
* These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/32.114.76.10/index.html),
|
|
4963
|
-
* both of these were documented on the same page.
|
|
4964
|
-
*
|
|
4965
|
-
* @packageDocumentation
|
|
4685
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
|
4966
4686
|
*/
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4687
|
+
class ApplicationModule extends base_1.Base {
|
|
4688
|
+
/**
|
|
4689
|
+
* Asynchronously returns an API handle for the given Application identity.
|
|
4690
|
+
*
|
|
4691
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
4692
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
4693
|
+
* for an Application throughout its entire lifecycle.
|
|
4694
|
+
*
|
|
4695
|
+
* @example
|
|
4696
|
+
*
|
|
4697
|
+
* ```js
|
|
4698
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
|
4699
|
+
* .then(app => app.isRunning())
|
|
4700
|
+
* .then(running => console.log('Application is running: ' + running))
|
|
4701
|
+
* .catch(err => console.log(err));
|
|
4702
|
+
* ```
|
|
4703
|
+
*
|
|
4704
|
+
*/
|
|
4705
|
+
async wrap(identity) {
|
|
4706
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
|
4707
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4708
|
+
});
|
|
4709
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
4710
|
+
if (errorMsg) {
|
|
4711
|
+
throw new Error(errorMsg);
|
|
4712
|
+
}
|
|
4713
|
+
return new Instance_1.Application(this.wire, identity);
|
|
4714
|
+
}
|
|
4715
|
+
/**
|
|
4716
|
+
* Synchronously returns an API handle for the given Application identity.
|
|
4717
|
+
*
|
|
4718
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
4719
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
4720
|
+
* for an Aplication throughout its entire lifecycle.
|
|
4721
|
+
*
|
|
4722
|
+
* @example
|
|
4723
|
+
*
|
|
4724
|
+
* ```js
|
|
4725
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
|
4726
|
+
* await app.close();
|
|
4727
|
+
* ```
|
|
4728
|
+
*
|
|
4729
|
+
*/
|
|
4730
|
+
wrapSync(identity) {
|
|
4731
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
|
4732
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4733
|
+
});
|
|
4734
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
4735
|
+
if (errorMsg) {
|
|
4736
|
+
throw new Error(errorMsg);
|
|
4737
|
+
}
|
|
4738
|
+
return new Instance_1.Application(this.wire, identity);
|
|
4739
|
+
}
|
|
4740
|
+
async _create(appOptions) {
|
|
4741
|
+
// set defaults:
|
|
4742
|
+
if (appOptions.waitForPageLoad === undefined) {
|
|
4743
|
+
appOptions.waitForPageLoad = false;
|
|
4744
|
+
}
|
|
4745
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
4746
|
+
appOptions.autoShow = true;
|
|
4747
|
+
}
|
|
4748
|
+
await this.wire.sendAction('create-application', appOptions);
|
|
4749
|
+
return this.wrap({ uuid: appOptions.uuid });
|
|
4750
|
+
}
|
|
4751
|
+
/**
|
|
4752
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
|
4753
|
+
*
|
|
4754
|
+
* @example
|
|
4755
|
+
*
|
|
4756
|
+
* ```js
|
|
4757
|
+
* async function createApp() {
|
|
4758
|
+
* const app = await fin.Application.create({
|
|
4759
|
+
* name: 'myApp',
|
|
4760
|
+
* uuid: 'app-3',
|
|
4761
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
|
4762
|
+
* autoShow: true
|
|
4763
|
+
* });
|
|
4764
|
+
* await app.run();
|
|
4765
|
+
* }
|
|
4766
|
+
*
|
|
4767
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
|
4768
|
+
* ```
|
|
4769
|
+
*
|
|
4770
|
+
* @ignore
|
|
4771
|
+
*/
|
|
4772
|
+
create(appOptions) {
|
|
4773
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
4774
|
+
this.wire.sendAction('application-create').catch((e) => {
|
|
4775
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4776
|
+
});
|
|
4777
|
+
return this._create(appOptions);
|
|
4778
|
+
}
|
|
4779
|
+
/**
|
|
4780
|
+
* Creates and starts a new Application.
|
|
4781
|
+
*
|
|
4782
|
+
* @example
|
|
4783
|
+
*
|
|
4784
|
+
* ```js
|
|
4785
|
+
* async function start() {
|
|
4786
|
+
* return fin.Application.start({
|
|
4787
|
+
* name: 'app-1',
|
|
4788
|
+
* uuid: 'app-1',
|
|
4789
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
|
4790
|
+
* autoShow: true
|
|
4791
|
+
* });
|
|
4792
|
+
* }
|
|
4793
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
4794
|
+
* ```
|
|
4795
|
+
*
|
|
4796
|
+
*/
|
|
4797
|
+
async start(appOptions) {
|
|
4798
|
+
this.wire.sendAction('start-application').catch((e) => {
|
|
4799
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4800
|
+
});
|
|
4801
|
+
const app = await this._create(appOptions);
|
|
4802
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
4803
|
+
return app;
|
|
4804
|
+
}
|
|
4805
|
+
/**
|
|
4806
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
4807
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
|
4808
|
+
* @param opts - Parameters that the RVM will use.
|
|
4809
|
+
*
|
|
4810
|
+
* @example
|
|
4811
|
+
*
|
|
4812
|
+
* ```js
|
|
4813
|
+
*
|
|
4814
|
+
* const applicationInfoArray = [
|
|
4815
|
+
* {
|
|
4816
|
+
* "uuid": 'App-1',
|
|
4817
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
|
4818
|
+
* },
|
|
4819
|
+
* {
|
|
4820
|
+
* "uuid": 'App-2',
|
|
4821
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
|
4822
|
+
* },
|
|
4823
|
+
* {
|
|
4824
|
+
* "uuid": 'App-3',
|
|
4825
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
|
4826
|
+
* }
|
|
4827
|
+
* ]
|
|
4828
|
+
*
|
|
4829
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
|
4830
|
+
* .then(() => {
|
|
4831
|
+
* console.log('RVM has finished launching the application list.');
|
|
4832
|
+
* })
|
|
4833
|
+
* .catch((err) => {
|
|
4834
|
+
* console.log(err);
|
|
4835
|
+
* })
|
|
4836
|
+
* ```
|
|
4837
|
+
*
|
|
4838
|
+
* @experimental
|
|
4839
|
+
*/
|
|
4840
|
+
async startManyManifests(applications, opts) {
|
|
4841
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
|
4842
|
+
}
|
|
4843
|
+
/**
|
|
4844
|
+
* Asynchronously returns an Application object that represents the current application
|
|
4845
|
+
*
|
|
4846
|
+
* @example
|
|
4847
|
+
*
|
|
4848
|
+
* ```js
|
|
4849
|
+
* async function isCurrentAppRunning () {
|
|
4850
|
+
* const app = await fin.Application.getCurrent();
|
|
4851
|
+
* return app.isRunning();
|
|
4852
|
+
* }
|
|
4853
|
+
*
|
|
4854
|
+
* isCurrentAppRunning().then(running => {
|
|
4855
|
+
* console.log(`Current app is running: ${running}`);
|
|
4856
|
+
* }).catch(err => {
|
|
4857
|
+
* console.error(err);
|
|
4858
|
+
* });
|
|
4859
|
+
*
|
|
4860
|
+
* ```
|
|
4861
|
+
*/
|
|
4862
|
+
getCurrent() {
|
|
4863
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
|
4864
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4865
|
+
});
|
|
4866
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
|
4867
|
+
}
|
|
4868
|
+
/**
|
|
4869
|
+
* Synchronously returns an Application object that represents the current application
|
|
4870
|
+
*
|
|
4871
|
+
* @example
|
|
4872
|
+
*
|
|
4873
|
+
* ```js
|
|
4874
|
+
* async function isCurrentAppRunning () {
|
|
4875
|
+
* const app = fin.Application.getCurrentSync();
|
|
4876
|
+
* return app.isRunning();
|
|
4877
|
+
* }
|
|
4878
|
+
*
|
|
4879
|
+
* isCurrentAppRunning().then(running => {
|
|
4880
|
+
* console.log(`Current app is running: ${running}`);
|
|
4881
|
+
* }).catch(err => {
|
|
4882
|
+
* console.error(err);
|
|
4883
|
+
* });
|
|
4884
|
+
*
|
|
4885
|
+
* ```
|
|
4886
|
+
*/
|
|
4887
|
+
getCurrentSync() {
|
|
4888
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
|
4889
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4890
|
+
});
|
|
4891
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
4892
|
+
}
|
|
4893
|
+
/**
|
|
4894
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
|
4895
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
4896
|
+
* @param opts - Parameters that the RVM will use.
|
|
4897
|
+
*
|
|
4898
|
+
* @example
|
|
4899
|
+
*
|
|
4900
|
+
* ```js
|
|
4901
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
4902
|
+
*
|
|
4903
|
+
* // For a local manifest file:
|
|
4904
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
4905
|
+
* ```
|
|
4906
|
+
*/
|
|
4907
|
+
async startFromManifest(manifestUrl, opts) {
|
|
4908
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
|
4909
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4910
|
+
});
|
|
4911
|
+
const app = await this._createFromManifest(manifestUrl);
|
|
4912
|
+
// @ts-expect-error using private method without warning.
|
|
4913
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
4914
|
+
return app;
|
|
4915
|
+
}
|
|
4916
|
+
/**
|
|
4917
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
|
4918
|
+
* Retrieves application's manifest and returns a wrapped application.
|
|
4919
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
4920
|
+
* @param callback - called if the method succeeds.
|
|
4921
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
4922
|
+
*
|
|
4923
|
+
* @example
|
|
4924
|
+
*
|
|
4925
|
+
* ```js
|
|
4926
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
|
4927
|
+
* ```
|
|
4928
|
+
* @ignore
|
|
4929
|
+
*/
|
|
4930
|
+
createFromManifest(manifestUrl) {
|
|
4931
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
4932
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
|
4933
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4934
|
+
});
|
|
4935
|
+
return this._createFromManifest(manifestUrl);
|
|
4936
|
+
}
|
|
4937
|
+
_createFromManifest(manifestUrl) {
|
|
4938
|
+
return this.wire
|
|
4939
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
|
4940
|
+
.then(({ payload }) => {
|
|
4941
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
4942
|
+
return this.wrap({ uuid });
|
|
4943
|
+
})
|
|
4944
|
+
.then((app) => {
|
|
4945
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
4946
|
+
return app;
|
|
4947
|
+
});
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
Factory$6.ApplicationModule = ApplicationModule;
|
|
4951
|
+
return Factory$6;
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
var hasRequiredApplication;
|
|
4955
|
+
|
|
4956
|
+
function requireApplication () {
|
|
4957
|
+
if (hasRequiredApplication) return application;
|
|
4958
|
+
hasRequiredApplication = 1;
|
|
4959
|
+
(function (exports) {
|
|
4960
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4961
|
+
if (k2 === undefined) k2 = k;
|
|
4962
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4963
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
4964
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
4965
|
+
}
|
|
4966
|
+
Object.defineProperty(o, k2, desc);
|
|
4967
|
+
}) : (function(o, m, k, k2) {
|
|
4968
|
+
if (k2 === undefined) k2 = k;
|
|
4969
|
+
o[k2] = m[k];
|
|
4970
|
+
}));
|
|
4971
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
4972
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4973
|
+
};
|
|
4974
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4975
|
+
/**
|
|
4976
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
|
4977
|
+
*
|
|
4978
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
4979
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
4980
|
+
*
|
|
4981
|
+
* These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/32.114.76.10/index.html),
|
|
4982
|
+
* both of these were documented on the same page.
|
|
4983
|
+
*
|
|
4984
|
+
* @packageDocumentation
|
|
4985
|
+
*/
|
|
4986
|
+
__exportStar(requireFactory$1(), exports);
|
|
4987
|
+
__exportStar(requireInstance$2(), exports);
|
|
4988
|
+
} (application));
|
|
4989
|
+
return application;
|
|
4990
|
+
}
|
|
4970
4991
|
|
|
4971
4992
|
var promisifySubscription$1 = {};
|
|
4972
4993
|
|
|
@@ -5010,7 +5031,7 @@ function requireInstance$1 () {
|
|
|
5010
5031
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5011
5032
|
/* eslint-disable no-console */
|
|
5012
5033
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
5013
|
-
const application_1 =
|
|
5034
|
+
const application_1 = requireApplication();
|
|
5014
5035
|
const main_1 = main;
|
|
5015
5036
|
const view_1 = requireView();
|
|
5016
5037
|
const warnings_1 = warnings;
|
|
@@ -7037,7 +7058,7 @@ function requireView () {
|
|
|
7037
7058
|
*
|
|
7038
7059
|
* @packageDocumentation
|
|
7039
7060
|
*/
|
|
7040
|
-
__exportStar(requireFactory$
|
|
7061
|
+
__exportStar(requireFactory$2(), exports);
|
|
7041
7062
|
__exportStar(requireInstance(), exports);
|
|
7042
7063
|
} (view));
|
|
7043
7064
|
return view;
|
|
@@ -7523,13 +7544,13 @@ function errorToPOJO(error) {
|
|
|
7523
7544
|
}
|
|
7524
7545
|
errors.errorToPOJO = errorToPOJO;
|
|
7525
7546
|
|
|
7526
|
-
var __classPrivateFieldSet$
|
|
7547
|
+
var __classPrivateFieldSet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7527
7548
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7528
7549
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7529
7550
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
7530
7551
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7531
7552
|
};
|
|
7532
|
-
var __classPrivateFieldGet$
|
|
7553
|
+
var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
7533
7554
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7534
7555
|
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");
|
|
7535
7556
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -7557,19 +7578,19 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7557
7578
|
// Typing as unknown to avoid circular dependency, should not be used directly.
|
|
7558
7579
|
_Transport_fin.set(this, void 0);
|
|
7559
7580
|
this.connectSync = () => {
|
|
7560
|
-
const wire = __classPrivateFieldGet$
|
|
7581
|
+
const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
|
|
7561
7582
|
wire.connectSync();
|
|
7562
7583
|
};
|
|
7563
7584
|
// This function is only used in our tests.
|
|
7564
7585
|
this.getPort = () => {
|
|
7565
|
-
const wire = __classPrivateFieldGet$
|
|
7586
|
+
const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
|
|
7566
7587
|
return wire.getPort();
|
|
7567
7588
|
};
|
|
7568
|
-
__classPrivateFieldSet$
|
|
7589
|
+
__classPrivateFieldSet$f(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
|
|
7569
7590
|
this.environment = environment;
|
|
7570
|
-
this.sendRaw = __classPrivateFieldGet$
|
|
7591
|
+
this.sendRaw = __classPrivateFieldGet$g(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$g(this, _Transport_wire, "f"));
|
|
7571
7592
|
this.registerMessageHandler(this.handleMessage.bind(this));
|
|
7572
|
-
__classPrivateFieldGet$
|
|
7593
|
+
__classPrivateFieldGet$g(this, _Transport_wire, "f").on('disconnected', () => {
|
|
7573
7594
|
for (const [, { handleNack }] of this.wireListeners) {
|
|
7574
7595
|
handleNack({ reason: 'Remote connection has closed' });
|
|
7575
7596
|
}
|
|
@@ -7581,24 +7602,24 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7581
7602
|
this.me = (0, me_1$1.getBaseMe)(entityType, uuid, name);
|
|
7582
7603
|
}
|
|
7583
7604
|
getFin() {
|
|
7584
|
-
if (!__classPrivateFieldGet$
|
|
7605
|
+
if (!__classPrivateFieldGet$g(this, _Transport_fin, "f")) {
|
|
7585
7606
|
throw new Error('No Fin object registered for this transport');
|
|
7586
7607
|
}
|
|
7587
|
-
return __classPrivateFieldGet$
|
|
7608
|
+
return __classPrivateFieldGet$g(this, _Transport_fin, "f");
|
|
7588
7609
|
}
|
|
7589
7610
|
registerFin(_fin) {
|
|
7590
|
-
if (__classPrivateFieldGet$
|
|
7611
|
+
if (__classPrivateFieldGet$g(this, _Transport_fin, "f")) {
|
|
7591
7612
|
throw new Error('Fin object has already been registered for this transport');
|
|
7592
7613
|
}
|
|
7593
|
-
__classPrivateFieldSet$
|
|
7614
|
+
__classPrivateFieldSet$f(this, _Transport_fin, _fin, "f");
|
|
7594
7615
|
}
|
|
7595
7616
|
shutdown() {
|
|
7596
|
-
const wire = __classPrivateFieldGet$
|
|
7617
|
+
const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
|
|
7597
7618
|
return wire.shutdown();
|
|
7598
7619
|
}
|
|
7599
7620
|
async connect(config) {
|
|
7600
7621
|
if ((0, wire_1.isConfigWithReceiver)(config)) {
|
|
7601
|
-
await __classPrivateFieldGet$
|
|
7622
|
+
await __classPrivateFieldGet$g(this, _Transport_wire, "f").connect(config.receiver);
|
|
7602
7623
|
return this.authorize(config);
|
|
7603
7624
|
}
|
|
7604
7625
|
if ((0, wire_1.isRemoteConfig)(config)) {
|
|
@@ -7614,13 +7635,13 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7614
7635
|
return undefined;
|
|
7615
7636
|
}
|
|
7616
7637
|
async connectRemote(config) {
|
|
7617
|
-
await __classPrivateFieldGet$
|
|
7638
|
+
await __classPrivateFieldGet$g(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
|
|
7618
7639
|
return this.authorize(config);
|
|
7619
7640
|
}
|
|
7620
7641
|
async connectByPort(config) {
|
|
7621
7642
|
const { address, uuid } = config;
|
|
7622
7643
|
const reqAuthPayload = { ...config, type: 'file-token' };
|
|
7623
|
-
const wire = __classPrivateFieldGet$
|
|
7644
|
+
const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
|
|
7624
7645
|
await wire.connect(new (this.environment.getWsConstructor())(config.address));
|
|
7625
7646
|
const requestExtAuthRet = await this.sendAction('request-external-authorization', {
|
|
7626
7647
|
uuid,
|
|
@@ -7656,7 +7677,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7656
7677
|
payload,
|
|
7657
7678
|
messageId
|
|
7658
7679
|
};
|
|
7659
|
-
const wire = __classPrivateFieldGet$
|
|
7680
|
+
const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
|
|
7660
7681
|
this.addWireListener(messageId, resolve, (payload) => this.nackHandler(payload, reject, callSites), uncorrelated);
|
|
7661
7682
|
return wire.send(msg).catch(reject);
|
|
7662
7683
|
});
|
|
@@ -7678,7 +7699,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7678
7699
|
const resolver = (data) => {
|
|
7679
7700
|
resolve(data.payload);
|
|
7680
7701
|
};
|
|
7681
|
-
const wire = __classPrivateFieldGet$
|
|
7702
|
+
const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
|
|
7682
7703
|
return wire
|
|
7683
7704
|
.send(origData)
|
|
7684
7705
|
.then(() => this.addWireListener(id, resolver, (payload) => this.nackHandler(payload, reject), false))
|
|
@@ -10155,12 +10176,12 @@ class ChannelError extends Error {
|
|
|
10155
10176
|
}
|
|
10156
10177
|
channelError.ChannelError = ChannelError;
|
|
10157
10178
|
|
|
10158
|
-
var __classPrivateFieldGet$
|
|
10179
|
+
var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10159
10180
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10160
10181
|
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");
|
|
10161
10182
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10162
10183
|
};
|
|
10163
|
-
var __classPrivateFieldSet$
|
|
10184
|
+
var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10164
10185
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10165
10186
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10166
10187
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -10204,7 +10225,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10204
10225
|
static closeChannelByEndpointId(id) {
|
|
10205
10226
|
const channel = channelClientsByEndpointId.get(id);
|
|
10206
10227
|
if (channel) {
|
|
10207
|
-
__classPrivateFieldGet$
|
|
10228
|
+
__classPrivateFieldGet$f(channel, _ChannelClient_close, "f").call(channel);
|
|
10208
10229
|
}
|
|
10209
10230
|
}
|
|
10210
10231
|
/**
|
|
@@ -10215,7 +10236,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10215
10236
|
for (const channelClient of channelClientsByEndpointId.values()) {
|
|
10216
10237
|
if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
|
|
10217
10238
|
channelClient.disconnectListener(eventPayload);
|
|
10218
|
-
__classPrivateFieldGet$
|
|
10239
|
+
__classPrivateFieldGet$f(channelClient, _ChannelClient_close, "f").call(channelClient);
|
|
10219
10240
|
}
|
|
10220
10241
|
}
|
|
10221
10242
|
}
|
|
@@ -10230,12 +10251,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10230
10251
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
|
10231
10252
|
_ChannelClient_close.set(this, () => {
|
|
10232
10253
|
channelClientsByEndpointId.delete(this.endpointId);
|
|
10233
|
-
__classPrivateFieldGet$
|
|
10254
|
+
__classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").close();
|
|
10234
10255
|
});
|
|
10235
|
-
__classPrivateFieldSet$
|
|
10256
|
+
__classPrivateFieldSet$e(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
|
|
10236
10257
|
this.disconnectListener = () => undefined;
|
|
10237
10258
|
this.endpointId = routingInfo.endpointId;
|
|
10238
|
-
__classPrivateFieldSet$
|
|
10259
|
+
__classPrivateFieldSet$e(this, _ChannelClient_strategy, strategy, "f");
|
|
10239
10260
|
channelClientsByEndpointId.set(this.endpointId, this);
|
|
10240
10261
|
strategy.receive(this.processAction);
|
|
10241
10262
|
}
|
|
@@ -10243,7 +10264,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10243
10264
|
* a read-only provider identity
|
|
10244
10265
|
*/
|
|
10245
10266
|
get providerIdentity() {
|
|
10246
|
-
const protectedObj = __classPrivateFieldGet$
|
|
10267
|
+
const protectedObj = __classPrivateFieldGet$f(this, _ChannelClient_protectedObj, "f");
|
|
10247
10268
|
return protectedObj.providerIdentity;
|
|
10248
10269
|
}
|
|
10249
10270
|
/**
|
|
@@ -10272,9 +10293,9 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10272
10293
|
* ```
|
|
10273
10294
|
*/
|
|
10274
10295
|
async dispatch(action, payload) {
|
|
10275
|
-
if (__classPrivateFieldGet$
|
|
10296
|
+
if (__classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
|
10276
10297
|
const callSites = transport_errors_1$1.RuntimeError.getCallSite();
|
|
10277
|
-
return __classPrivateFieldGet$
|
|
10298
|
+
return __classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
|
|
10278
10299
|
throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
|
|
10279
10300
|
});
|
|
10280
10301
|
}
|
|
@@ -10326,10 +10347,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10326
10347
|
*/
|
|
10327
10348
|
async disconnect() {
|
|
10328
10349
|
await this.sendDisconnectAction();
|
|
10329
|
-
__classPrivateFieldGet$
|
|
10350
|
+
__classPrivateFieldGet$f(this, _ChannelClient_close, "f").call(this);
|
|
10330
10351
|
}
|
|
10331
10352
|
async sendDisconnectAction() {
|
|
10332
|
-
const protectedObj = __classPrivateFieldGet$
|
|
10353
|
+
const protectedObj = __classPrivateFieldGet$f(this, _ChannelClient_protectedObj, "f");
|
|
10333
10354
|
await protectedObj.close();
|
|
10334
10355
|
}
|
|
10335
10356
|
/**
|
|
@@ -10362,13 +10383,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
|
|
|
10362
10383
|
|
|
10363
10384
|
var strategy$3 = {};
|
|
10364
10385
|
|
|
10365
|
-
var __classPrivateFieldSet$
|
|
10386
|
+
var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10366
10387
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10367
10388
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10368
10389
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10369
10390
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
10370
10391
|
};
|
|
10371
|
-
var __classPrivateFieldGet$
|
|
10392
|
+
var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10372
10393
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10373
10394
|
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");
|
|
10374
10395
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -10393,7 +10414,7 @@ class ClassicStrategy {
|
|
|
10393
10414
|
// connection problems occur
|
|
10394
10415
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
|
|
10395
10416
|
this.send = async (endpointId, action, payload) => {
|
|
10396
|
-
const to = __classPrivateFieldGet$
|
|
10417
|
+
const to = __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
10397
10418
|
if (!to) {
|
|
10398
10419
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
|
10399
10420
|
}
|
|
@@ -10405,13 +10426,13 @@ class ClassicStrategy {
|
|
|
10405
10426
|
}
|
|
10406
10427
|
delete cleanId.isLocalEndpointId;
|
|
10407
10428
|
// grab the promise before awaiting it to save in our pending messages map
|
|
10408
|
-
const p = __classPrivateFieldGet$
|
|
10429
|
+
const p = __classPrivateFieldGet$e(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
|
|
10409
10430
|
...cleanId,
|
|
10410
10431
|
providerIdentity: this.providerIdentity,
|
|
10411
10432
|
action,
|
|
10412
10433
|
payload
|
|
10413
10434
|
});
|
|
10414
|
-
__classPrivateFieldGet$
|
|
10435
|
+
__classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
|
10415
10436
|
const raw = await p
|
|
10416
10437
|
.catch((error) => {
|
|
10417
10438
|
if ('cause' in error) {
|
|
@@ -10421,16 +10442,16 @@ class ClassicStrategy {
|
|
|
10421
10442
|
})
|
|
10422
10443
|
.finally(() => {
|
|
10423
10444
|
// clean up the pending promise
|
|
10424
|
-
__classPrivateFieldGet$
|
|
10445
|
+
__classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
|
10425
10446
|
});
|
|
10426
10447
|
return raw.payload.data.result;
|
|
10427
10448
|
};
|
|
10428
10449
|
this.close = async () => {
|
|
10429
10450
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
|
10430
|
-
[...__classPrivateFieldGet$
|
|
10431
|
-
__classPrivateFieldSet$
|
|
10451
|
+
[...__classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
|
|
10452
|
+
__classPrivateFieldSet$d(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
|
10432
10453
|
};
|
|
10433
|
-
__classPrivateFieldSet$
|
|
10454
|
+
__classPrivateFieldSet$d(this, _ClassicStrategy_wire, wire, "f");
|
|
10434
10455
|
}
|
|
10435
10456
|
onEndpointDisconnect(endpointId, listener) {
|
|
10436
10457
|
// Never fires for 'classic'.
|
|
@@ -10439,20 +10460,20 @@ class ClassicStrategy {
|
|
|
10439
10460
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
|
10440
10461
|
}
|
|
10441
10462
|
async closeEndpoint(endpointId) {
|
|
10442
|
-
const id = __classPrivateFieldGet$
|
|
10443
|
-
__classPrivateFieldGet$
|
|
10444
|
-
const pendingSet = __classPrivateFieldGet$
|
|
10463
|
+
const id = __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
10464
|
+
__classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
|
10465
|
+
const pendingSet = __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
|
10445
10466
|
pendingSet?.forEach((p) => {
|
|
10446
10467
|
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
|
10447
10468
|
p.cancel(new Error(errorMsg));
|
|
10448
10469
|
});
|
|
10449
10470
|
}
|
|
10450
10471
|
isEndpointConnected(endpointId) {
|
|
10451
|
-
return __classPrivateFieldGet$
|
|
10472
|
+
return __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
|
10452
10473
|
}
|
|
10453
10474
|
addEndpoint(endpointId, payload) {
|
|
10454
|
-
__classPrivateFieldGet$
|
|
10455
|
-
__classPrivateFieldGet$
|
|
10475
|
+
__classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
|
10476
|
+
__classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
|
10456
10477
|
}
|
|
10457
10478
|
isValidEndpointPayload(payload) {
|
|
10458
10479
|
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
|
@@ -10468,12 +10489,12 @@ var strategy$2 = {};
|
|
|
10468
10489
|
|
|
10469
10490
|
var endpoint = {};
|
|
10470
10491
|
|
|
10471
|
-
var __classPrivateFieldGet$
|
|
10492
|
+
var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10472
10493
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10473
10494
|
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");
|
|
10474
10495
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10475
10496
|
};
|
|
10476
|
-
var __classPrivateFieldSet$
|
|
10497
|
+
var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10477
10498
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10478
10499
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10479
10500
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -10508,8 +10529,8 @@ class RTCEndpoint {
|
|
|
10508
10529
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
|
10509
10530
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
10510
10531
|
this.close();
|
|
10511
|
-
if (__classPrivateFieldGet$
|
|
10512
|
-
__classPrivateFieldGet$
|
|
10532
|
+
if (__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
10533
|
+
__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
10513
10534
|
}
|
|
10514
10535
|
}
|
|
10515
10536
|
};
|
|
@@ -10557,9 +10578,9 @@ class RTCEndpoint {
|
|
|
10557
10578
|
data = new TextDecoder().decode(e.data);
|
|
10558
10579
|
}
|
|
10559
10580
|
const { messageId, action, payload } = JSON.parse(data);
|
|
10560
|
-
if (__classPrivateFieldGet$
|
|
10581
|
+
if (__classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f")) {
|
|
10561
10582
|
try {
|
|
10562
|
-
const res = await __classPrivateFieldGet$
|
|
10583
|
+
const res = await __classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
|
10563
10584
|
this.rtc.channels.response.send(JSON.stringify({
|
|
10564
10585
|
messageId,
|
|
10565
10586
|
payload: res,
|
|
@@ -10593,25 +10614,25 @@ class RTCEndpoint {
|
|
|
10593
10614
|
datachannel.onclose = (e) => {
|
|
10594
10615
|
[...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
|
|
10595
10616
|
this.close();
|
|
10596
|
-
if (__classPrivateFieldGet$
|
|
10597
|
-
__classPrivateFieldGet$
|
|
10617
|
+
if (__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
10618
|
+
__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
10598
10619
|
}
|
|
10599
10620
|
};
|
|
10600
10621
|
});
|
|
10601
10622
|
}
|
|
10602
10623
|
onDisconnect(listener) {
|
|
10603
|
-
if (!__classPrivateFieldGet$
|
|
10604
|
-
__classPrivateFieldSet$
|
|
10624
|
+
if (!__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
10625
|
+
__classPrivateFieldSet$c(this, _RTCEndpoint_disconnectListener, listener, "f");
|
|
10605
10626
|
}
|
|
10606
10627
|
else {
|
|
10607
10628
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
|
10608
10629
|
}
|
|
10609
10630
|
}
|
|
10610
10631
|
receive(listener) {
|
|
10611
|
-
if (__classPrivateFieldGet$
|
|
10632
|
+
if (__classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f")) {
|
|
10612
10633
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
|
10613
10634
|
}
|
|
10614
|
-
__classPrivateFieldSet$
|
|
10635
|
+
__classPrivateFieldSet$c(this, _RTCEndpoint_processAction, listener, "f");
|
|
10615
10636
|
}
|
|
10616
10637
|
get connected() {
|
|
10617
10638
|
return this.rtc.rtcClient.connectionState === 'connected';
|
|
@@ -10622,12 +10643,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
|
|
|
10622
10643
|
|
|
10623
10644
|
var strategy$1 = {};
|
|
10624
10645
|
|
|
10625
|
-
var __classPrivateFieldGet$
|
|
10646
|
+
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10626
10647
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10627
10648
|
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");
|
|
10628
10649
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10629
10650
|
};
|
|
10630
|
-
var __classPrivateFieldSet$
|
|
10651
|
+
var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10631
10652
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10632
10653
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10633
10654
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -10648,11 +10669,11 @@ class EndpointStrategy {
|
|
|
10648
10669
|
return this.getEndpointById(endpointId).send(action, payload);
|
|
10649
10670
|
};
|
|
10650
10671
|
this.close = async () => {
|
|
10651
|
-
if (__classPrivateFieldGet$
|
|
10652
|
-
__classPrivateFieldGet$
|
|
10653
|
-
__classPrivateFieldSet$
|
|
10672
|
+
if (__classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f")) {
|
|
10673
|
+
__classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
|
|
10674
|
+
__classPrivateFieldSet$b(this, _EndpointStrategy_endpointMap, new Map(), "f");
|
|
10654
10675
|
}
|
|
10655
|
-
__classPrivateFieldSet$
|
|
10676
|
+
__classPrivateFieldSet$b(this, _EndpointStrategy_connected, false, "f");
|
|
10656
10677
|
};
|
|
10657
10678
|
this.isValidEndpointPayload = validateEndpoint;
|
|
10658
10679
|
}
|
|
@@ -10660,39 +10681,39 @@ class EndpointStrategy {
|
|
|
10660
10681
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
|
10661
10682
|
}
|
|
10662
10683
|
receive(listener) {
|
|
10663
|
-
if (__classPrivateFieldGet$
|
|
10684
|
+
if (__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")) {
|
|
10664
10685
|
throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
|
|
10665
10686
|
}
|
|
10666
|
-
__classPrivateFieldSet$
|
|
10687
|
+
__classPrivateFieldSet$b(this, _EndpointStrategy_processAction, listener, "f");
|
|
10667
10688
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10668
|
-
__classPrivateFieldGet$
|
|
10689
|
+
__classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")));
|
|
10669
10690
|
}
|
|
10670
10691
|
getEndpointById(endpointId) {
|
|
10671
|
-
const endpoint = __classPrivateFieldGet$
|
|
10692
|
+
const endpoint = __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
|
|
10672
10693
|
if (!endpoint) {
|
|
10673
10694
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
|
10674
10695
|
}
|
|
10675
10696
|
return endpoint;
|
|
10676
10697
|
}
|
|
10677
10698
|
get connected() {
|
|
10678
|
-
return __classPrivateFieldGet$
|
|
10699
|
+
return __classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f");
|
|
10679
10700
|
}
|
|
10680
10701
|
isEndpointConnected(endpointId) {
|
|
10681
|
-
return __classPrivateFieldGet$
|
|
10702
|
+
return __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
|
|
10682
10703
|
}
|
|
10683
10704
|
addEndpoint(endpointId, payload) {
|
|
10684
|
-
if (!__classPrivateFieldGet$
|
|
10705
|
+
if (!__classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f")) {
|
|
10685
10706
|
console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
|
|
10686
10707
|
return;
|
|
10687
10708
|
}
|
|
10688
10709
|
const clientStrat = new this.EndpointType(payload);
|
|
10689
|
-
if (__classPrivateFieldGet$
|
|
10690
|
-
clientStrat.receive(__classPrivateFieldGet$
|
|
10710
|
+
if (__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")) {
|
|
10711
|
+
clientStrat.receive(__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f"));
|
|
10691
10712
|
}
|
|
10692
|
-
__classPrivateFieldGet$
|
|
10713
|
+
__classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
|
|
10693
10714
|
}
|
|
10694
10715
|
async closeEndpoint(endpointId) {
|
|
10695
|
-
__classPrivateFieldGet$
|
|
10716
|
+
__classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
|
|
10696
10717
|
}
|
|
10697
10718
|
}
|
|
10698
10719
|
strategy$1.EndpointStrategy = EndpointStrategy;
|
|
@@ -10874,12 +10895,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
|
|
|
10874
10895
|
}
|
|
10875
10896
|
runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
|
|
10876
10897
|
|
|
10877
|
-
var __classPrivateFieldGet$
|
|
10898
|
+
var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10878
10899
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10879
10900
|
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");
|
|
10880
10901
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10881
10902
|
};
|
|
10882
|
-
var __classPrivateFieldSet$
|
|
10903
|
+
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10883
10904
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10884
10905
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10885
10906
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -10923,19 +10944,19 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
10923
10944
|
* a read-only array containing all the identities of connecting clients.
|
|
10924
10945
|
*/
|
|
10925
10946
|
get connections() {
|
|
10926
|
-
return [...__classPrivateFieldGet$
|
|
10947
|
+
return [...__classPrivateFieldGet$b(this, _ChannelProvider_connections, "f")];
|
|
10927
10948
|
}
|
|
10928
10949
|
static handleClientDisconnection(channel, payload) {
|
|
10929
10950
|
if (payload?.endpointId) {
|
|
10930
10951
|
const { uuid, name, endpointId, isLocalEndpointId } = payload;
|
|
10931
|
-
__classPrivateFieldGet$
|
|
10952
|
+
__classPrivateFieldGet$b(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
10932
10953
|
}
|
|
10933
10954
|
else {
|
|
10934
10955
|
// this is here to support older runtimes that did not have endpointId
|
|
10935
10956
|
const multipleRemoves = channel.connections.filter((identity) => {
|
|
10936
10957
|
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
10937
10958
|
});
|
|
10938
|
-
multipleRemoves.forEach(__classPrivateFieldGet$
|
|
10959
|
+
multipleRemoves.forEach(__classPrivateFieldGet$b(channel, _ChannelProvider_removeEndpoint, "f"));
|
|
10939
10960
|
}
|
|
10940
10961
|
channel.disconnectListener(payload);
|
|
10941
10962
|
}
|
|
@@ -10952,8 +10973,8 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
10952
10973
|
_ChannelProvider_strategy.set(this, void 0);
|
|
10953
10974
|
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
|
10954
10975
|
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
|
10955
|
-
__classPrivateFieldGet$
|
|
10956
|
-
__classPrivateFieldSet$
|
|
10976
|
+
__classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
|
10977
|
+
__classPrivateFieldSet$a(this, _ChannelProvider_connections, remainingConnections, "f");
|
|
10957
10978
|
});
|
|
10958
10979
|
// Must be bound.
|
|
10959
10980
|
this.processAction = async (action, payload, senderIdentity) => {
|
|
@@ -10967,17 +10988,17 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
10967
10988
|
return super.processAction(action, payload, senderIdentity);
|
|
10968
10989
|
};
|
|
10969
10990
|
_ChannelProvider_close.set(this, () => {
|
|
10970
|
-
__classPrivateFieldGet$
|
|
10991
|
+
__classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").close();
|
|
10971
10992
|
const remove = ChannelProvider.removalMap.get(this);
|
|
10972
10993
|
if (remove) {
|
|
10973
10994
|
remove();
|
|
10974
10995
|
}
|
|
10975
10996
|
});
|
|
10976
|
-
__classPrivateFieldSet$
|
|
10997
|
+
__classPrivateFieldSet$a(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
|
|
10977
10998
|
this.connectListener = () => undefined;
|
|
10978
10999
|
this.disconnectListener = () => undefined;
|
|
10979
|
-
__classPrivateFieldSet$
|
|
10980
|
-
__classPrivateFieldSet$
|
|
11000
|
+
__classPrivateFieldSet$a(this, _ChannelProvider_connections, [], "f");
|
|
11001
|
+
__classPrivateFieldSet$a(this, _ChannelProvider_strategy, strategy, "f");
|
|
10981
11002
|
strategy.receive(this.processAction);
|
|
10982
11003
|
}
|
|
10983
11004
|
/**
|
|
@@ -11008,16 +11029,16 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11008
11029
|
*/
|
|
11009
11030
|
dispatch(to, action, payload) {
|
|
11010
11031
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
|
11011
|
-
if (endpointId && __classPrivateFieldGet$
|
|
11032
|
+
if (endpointId && __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
|
11012
11033
|
const callSites = transport_errors_1.RuntimeError.getCallSite();
|
|
11013
|
-
return __classPrivateFieldGet$
|
|
11034
|
+
return __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
|
|
11014
11035
|
throw new channel_error_1.ChannelError(e, action, payload, callSites);
|
|
11015
11036
|
});
|
|
11016
11037
|
}
|
|
11017
11038
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
|
11018
11039
|
}
|
|
11019
11040
|
async processConnection(senderId, payload) {
|
|
11020
|
-
__classPrivateFieldGet$
|
|
11041
|
+
__classPrivateFieldGet$b(this, _ChannelProvider_connections, "f").push(senderId);
|
|
11021
11042
|
return this.connectListener(senderId, payload);
|
|
11022
11043
|
}
|
|
11023
11044
|
/**
|
|
@@ -11040,7 +11061,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11040
11061
|
* ```
|
|
11041
11062
|
*/
|
|
11042
11063
|
publish(action, payload) {
|
|
11043
|
-
return this.connections.map((to) => __classPrivateFieldGet$
|
|
11064
|
+
return this.connections.map((to) => __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
|
11044
11065
|
}
|
|
11045
11066
|
/**
|
|
11046
11067
|
* Register a listener that is called on every new client connection.
|
|
@@ -11114,11 +11135,11 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11114
11135
|
* ```
|
|
11115
11136
|
*/
|
|
11116
11137
|
async destroy() {
|
|
11117
|
-
const protectedObj = __classPrivateFieldGet$
|
|
11138
|
+
const protectedObj = __classPrivateFieldGet$b(this, _ChannelProvider_protectedObj, "f");
|
|
11118
11139
|
protectedObj.providerIdentity;
|
|
11119
|
-
__classPrivateFieldSet$
|
|
11140
|
+
__classPrivateFieldSet$a(this, _ChannelProvider_connections, [], "f");
|
|
11120
11141
|
await protectedObj.close();
|
|
11121
|
-
__classPrivateFieldGet$
|
|
11142
|
+
__classPrivateFieldGet$b(this, _ChannelProvider_close, "f").call(this);
|
|
11122
11143
|
}
|
|
11123
11144
|
/**
|
|
11124
11145
|
* Returns an array with info on every Client connected to the Provider
|
|
@@ -11188,7 +11209,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11188
11209
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
|
11189
11210
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
|
11190
11211
|
if (matchingConnections.length >= 2) {
|
|
11191
|
-
const protectedObj = __classPrivateFieldGet$
|
|
11212
|
+
const protectedObj = __classPrivateFieldGet$b(this, _ChannelProvider_protectedObj, "f");
|
|
11192
11213
|
const { uuid, name } = clientIdentity;
|
|
11193
11214
|
const providerUuid = protectedObj?.providerIdentity.uuid;
|
|
11194
11215
|
const providerName = protectedObj?.providerIdentity.name;
|
|
@@ -11400,13 +11421,13 @@ class CombinedStrategy {
|
|
|
11400
11421
|
}
|
|
11401
11422
|
strategy.default = CombinedStrategy;
|
|
11402
11423
|
|
|
11403
|
-
var __classPrivateFieldSet$
|
|
11424
|
+
var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11404
11425
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11405
11426
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
11406
11427
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11407
11428
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11408
11429
|
};
|
|
11409
|
-
var __classPrivateFieldGet$
|
|
11430
|
+
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11410
11431
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
11411
11432
|
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");
|
|
11412
11433
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -11455,8 +11476,8 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11455
11476
|
};
|
|
11456
11477
|
this.providerMap = new Map();
|
|
11457
11478
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
11458
|
-
__classPrivateFieldSet$
|
|
11459
|
-
__classPrivateFieldSet$
|
|
11479
|
+
__classPrivateFieldSet$9(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
|
11480
|
+
__classPrivateFieldSet$9(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
|
11460
11481
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
11461
11482
|
}
|
|
11462
11483
|
createProvider(options, providerIdentity) {
|
|
@@ -11467,7 +11488,7 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11467
11488
|
case 'rtc':
|
|
11468
11489
|
return new strategy_2.RTCStrategy();
|
|
11469
11490
|
case 'classic':
|
|
11470
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
11491
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f"),
|
|
11471
11492
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
|
11472
11493
|
providerIdentity.channelId, providerIdentity);
|
|
11473
11494
|
default:
|
|
@@ -11503,7 +11524,7 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11503
11524
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
|
11504
11525
|
switch (type) {
|
|
11505
11526
|
case 'rtc': {
|
|
11506
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$
|
|
11527
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
|
11507
11528
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
|
11508
11529
|
return {
|
|
11509
11530
|
type: 'rtc',
|
|
@@ -11530,18 +11551,18 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11530
11551
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
|
11531
11552
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
|
11532
11553
|
// clients that are in the same context as the newly-connected client.
|
|
11533
|
-
__classPrivateFieldGet$
|
|
11554
|
+
__classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
|
11534
11555
|
}
|
|
11535
11556
|
const answer = routingInfo.answer ?? {
|
|
11536
11557
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
|
11537
11558
|
};
|
|
11538
11559
|
const createStrategyFromAnswer = async (protocol) => {
|
|
11539
11560
|
if (protocol.type === 'rtc' && rtcPacket) {
|
|
11540
|
-
await __classPrivateFieldGet$
|
|
11561
|
+
await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
|
11541
11562
|
return new strategy_2.RTCStrategy();
|
|
11542
11563
|
}
|
|
11543
11564
|
if (protocol.type === 'classic') {
|
|
11544
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
11565
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
|
11545
11566
|
}
|
|
11546
11567
|
return null;
|
|
11547
11568
|
};
|
|
@@ -11609,7 +11630,7 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11609
11630
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
|
11610
11631
|
const answer = await accumP;
|
|
11611
11632
|
if (protocolToUse.type === 'rtc') {
|
|
11612
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$
|
|
11633
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
|
11613
11634
|
answer.supportedProtocols.push({
|
|
11614
11635
|
type: 'rtc',
|
|
11615
11636
|
version: strategy_2.RTCInfo.version,
|
|
@@ -11657,13 +11678,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
|
|
|
11657
11678
|
*
|
|
11658
11679
|
* @packageDocumentation
|
|
11659
11680
|
*/
|
|
11660
|
-
var __classPrivateFieldSet$
|
|
11681
|
+
var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11661
11682
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11662
11683
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
11663
11684
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11664
11685
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11665
11686
|
};
|
|
11666
|
-
var __classPrivateFieldGet$
|
|
11687
|
+
var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11667
11688
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
11668
11689
|
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");
|
|
11669
11690
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -11720,11 +11741,11 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11720
11741
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
|
11721
11742
|
}),
|
|
11722
11743
|
this.on('connected', (...args) => {
|
|
11723
|
-
__classPrivateFieldGet$
|
|
11744
|
+
__classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").emit('connected', ...args);
|
|
11724
11745
|
})
|
|
11725
11746
|
]).catch(() => new Error('error setting up channel connection listeners'));
|
|
11726
11747
|
}));
|
|
11727
|
-
__classPrivateFieldSet$
|
|
11748
|
+
__classPrivateFieldSet$8(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
|
11728
11749
|
}
|
|
11729
11750
|
/**
|
|
11730
11751
|
*
|
|
@@ -11799,7 +11820,7 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11799
11820
|
resolve(true);
|
|
11800
11821
|
}
|
|
11801
11822
|
};
|
|
11802
|
-
__classPrivateFieldGet$
|
|
11823
|
+
__classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
|
|
11803
11824
|
});
|
|
11804
11825
|
try {
|
|
11805
11826
|
if (retryInfo.count > 0) {
|
|
@@ -11831,7 +11852,7 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11831
11852
|
finally {
|
|
11832
11853
|
retryInfo.count += 1;
|
|
11833
11854
|
// in case of other errors, remove our listener
|
|
11834
|
-
__classPrivateFieldGet$
|
|
11855
|
+
__classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
|
|
11835
11856
|
}
|
|
11836
11857
|
} while (shouldWait); // If we're waiting we retry the above loop
|
|
11837
11858
|
// Should wait was false, no channel was found.
|
|
@@ -11890,12 +11911,12 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11890
11911
|
async connect(channelName, options = {}) {
|
|
11891
11912
|
// Make sure we don't connect before listeners are set up
|
|
11892
11913
|
// This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
|
|
11893
|
-
await __classPrivateFieldGet$
|
|
11914
|
+
await __classPrivateFieldGet$9(this, _Channel_readyToConnect, "f").getValue();
|
|
11894
11915
|
if (!channelName || typeof channelName !== 'string') {
|
|
11895
11916
|
throw new Error('Please provide a channelName string to connect to a channel.');
|
|
11896
11917
|
}
|
|
11897
11918
|
const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
|
|
11898
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$
|
|
11919
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
|
11899
11920
|
let connectionUrl;
|
|
11900
11921
|
if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
|
|
11901
11922
|
connectionUrl = (await this.fin.me.getInfo()).url;
|
|
@@ -11907,7 +11928,7 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11907
11928
|
connectionUrl
|
|
11908
11929
|
};
|
|
11909
11930
|
const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
|
|
11910
|
-
const strategy = await __classPrivateFieldGet$
|
|
11931
|
+
const strategy = await __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
|
11911
11932
|
const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
|
|
11912
11933
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
|
11913
11934
|
// If the endpoint dies, the client will force a disconnection through the core.
|
|
@@ -11976,7 +11997,7 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11976
11997
|
throw new Error('Please provide a channelName to create a channel');
|
|
11977
11998
|
}
|
|
11978
11999
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
11979
|
-
const channel = __classPrivateFieldGet$
|
|
12000
|
+
const channel = __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
11980
12001
|
// TODO: fix typing (internal)
|
|
11981
12002
|
// @ts-expect-error
|
|
11982
12003
|
this.on('client-disconnected', (eventPayload) => {
|
|
@@ -12212,14 +12233,32 @@ var clipboard = {};
|
|
|
12212
12233
|
*
|
|
12213
12234
|
* @packageDocumentation
|
|
12214
12235
|
*/
|
|
12236
|
+
var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12237
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12238
|
+
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");
|
|
12239
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12240
|
+
};
|
|
12241
|
+
var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12242
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12243
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12244
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
12245
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12246
|
+
};
|
|
12247
|
+
var _Clipboard_instances, _Clipboard_securedApiWarningCount, _Clipboard_warnSecuredApi;
|
|
12215
12248
|
Object.defineProperty(clipboard, "__esModule", { value: true });
|
|
12216
12249
|
clipboard.Clipboard = void 0;
|
|
12217
12250
|
const base_1$a = base;
|
|
12251
|
+
const maxSecuredApiWarnings = 10;
|
|
12218
12252
|
/**
|
|
12219
12253
|
* The Clipboard API allows reading and writing to the clipboard in multiple formats.
|
|
12220
12254
|
*
|
|
12221
12255
|
*/
|
|
12222
12256
|
class Clipboard extends base_1$a.Base {
|
|
12257
|
+
constructor() {
|
|
12258
|
+
super(...arguments);
|
|
12259
|
+
_Clipboard_instances.add(this);
|
|
12260
|
+
_Clipboard_securedApiWarningCount.set(this, 0);
|
|
12261
|
+
}
|
|
12223
12262
|
/**
|
|
12224
12263
|
* Writes data into the clipboard as plain text
|
|
12225
12264
|
* @param writeObj The object for writing data into the clipboard
|
|
@@ -12232,6 +12271,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12232
12271
|
* ```
|
|
12233
12272
|
*/
|
|
12234
12273
|
async writeText(writeObj) {
|
|
12274
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeText');
|
|
12235
12275
|
await this.wire.sendAction('clipboard-write-text', writeObj);
|
|
12236
12276
|
}
|
|
12237
12277
|
/**
|
|
@@ -12244,6 +12284,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12244
12284
|
* ```
|
|
12245
12285
|
*/
|
|
12246
12286
|
async readText(type) {
|
|
12287
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readText');
|
|
12247
12288
|
// NOTE: When we start supporting linux, we could detect the OS and choose 'selection' automatically for the user
|
|
12248
12289
|
const { payload } = await this.wire.sendAction('clipboard-read-text', { type });
|
|
12249
12290
|
return payload.data;
|
|
@@ -12261,6 +12302,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12261
12302
|
* ```
|
|
12262
12303
|
*/
|
|
12263
12304
|
async writeImage(writeRequest) {
|
|
12305
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeImage');
|
|
12264
12306
|
await this.wire.sendAction('clipboard-write-image', writeRequest);
|
|
12265
12307
|
}
|
|
12266
12308
|
/**
|
|
@@ -12296,6 +12338,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12296
12338
|
* ```
|
|
12297
12339
|
*/
|
|
12298
12340
|
async readImage(readRequest = { format: 'dataURL' }) {
|
|
12341
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readImage');
|
|
12299
12342
|
const { payload } = await this.wire.sendAction('clipboard-read-image', readRequest);
|
|
12300
12343
|
return payload.data;
|
|
12301
12344
|
}
|
|
@@ -12311,6 +12354,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12311
12354
|
* ```
|
|
12312
12355
|
*/
|
|
12313
12356
|
async writeHtml(writeObj) {
|
|
12357
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeHtml');
|
|
12314
12358
|
await this.wire.sendAction('clipboard-write-html', writeObj);
|
|
12315
12359
|
}
|
|
12316
12360
|
/**
|
|
@@ -12323,6 +12367,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12323
12367
|
* ```
|
|
12324
12368
|
*/
|
|
12325
12369
|
async readHtml(type) {
|
|
12370
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readHtml');
|
|
12326
12371
|
const { payload } = await this.wire.sendAction('clipboard-read-html', { type });
|
|
12327
12372
|
return payload.data;
|
|
12328
12373
|
}
|
|
@@ -12338,6 +12383,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12338
12383
|
* ```
|
|
12339
12384
|
*/
|
|
12340
12385
|
async writeRtf(writeObj) {
|
|
12386
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeRtf');
|
|
12341
12387
|
await this.wire.sendAction('clipboard-write-rtf', writeObj);
|
|
12342
12388
|
}
|
|
12343
12389
|
/**
|
|
@@ -12358,6 +12404,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12358
12404
|
* ```
|
|
12359
12405
|
*/
|
|
12360
12406
|
async readRtf(type) {
|
|
12407
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readRtf');
|
|
12361
12408
|
const { payload } = await this.wire.sendAction('clipboard-read-rtf', { type });
|
|
12362
12409
|
return payload.data;
|
|
12363
12410
|
}
|
|
@@ -12381,6 +12428,7 @@ class Clipboard extends base_1$a.Base {
|
|
|
12381
12428
|
* ```
|
|
12382
12429
|
*/
|
|
12383
12430
|
async write(writeObj) {
|
|
12431
|
+
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.write');
|
|
12384
12432
|
await this.wire.sendAction('clipboard-write', writeObj);
|
|
12385
12433
|
}
|
|
12386
12434
|
/**
|
|
@@ -12398,6 +12446,12 @@ class Clipboard extends base_1$a.Base {
|
|
|
12398
12446
|
}
|
|
12399
12447
|
}
|
|
12400
12448
|
clipboard.Clipboard = Clipboard;
|
|
12449
|
+
_Clipboard_securedApiWarningCount = new WeakMap(), _Clipboard_instances = new WeakSet(), _Clipboard_warnSecuredApi = async function _Clipboard_warnSecuredApi(apiName) {
|
|
12450
|
+
if (__classPrivateFieldGet$8(this, _Clipboard_securedApiWarningCount, "f") <= maxSecuredApiWarnings) {
|
|
12451
|
+
console.warn(`Here's Clipboard APIs will become secured APIs starting in v42. To continue using this API without interruption, make sure to grant explicit API permissions for ${apiName} in the Desktop Owner Settings, and in the Application, Window, View, or Domain Settings. For more information, see https://resources.here.io/docs/core/develop/security/api-security/`);
|
|
12452
|
+
__classPrivateFieldSet$7(this, _Clipboard_securedApiWarningCount, __classPrivateFieldGet$8(this, _Clipboard_securedApiWarningCount, "f") + 1, "f");
|
|
12453
|
+
}
|
|
12454
|
+
};
|
|
12401
12455
|
|
|
12402
12456
|
var globalHotkey = {};
|
|
12403
12457
|
|
|
@@ -17435,7 +17489,7 @@ const events_1 = require$$0;
|
|
|
17435
17489
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
|
17436
17490
|
const index_1 = system;
|
|
17437
17491
|
const index_2 = requireWindow();
|
|
17438
|
-
const index_3 =
|
|
17492
|
+
const index_3 = requireApplication();
|
|
17439
17493
|
const index_4 = interappbus;
|
|
17440
17494
|
const index_5 = clipboard;
|
|
17441
17495
|
const index_6 = externalApplication;
|