@openfin/core 33.76.36 → 33.76.38
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/OpenFin.d.ts +1 -1
- package/README.md +29 -4
- package/fin.d.ts +2 -2
- package/{src → out}/GlobalOpenFin.d.ts +1 -1
- package/out/mock-alpha.d.ts +16112 -0
- package/out/mock-beta.d.ts +16112 -0
- package/out/mock-public.d.ts +16112 -0
- package/out/mock.d.ts +16797 -0
- package/out/mock.js +17104 -0
- package/package.json +30 -23
- package/LICENSE +0 -13
- package/NOTICE +0 -16
- package/openfin-core-33.76.36.tgz +0 -0
- package/src/OpenFin.d.ts +0 -3091
- package/src/OpenFin.js +0 -2
- package/src/api/api-exposer/api-consumer.d.ts +0 -28
- package/src/api/api-exposer/api-consumer.js +0 -28
- package/src/api/api-exposer/api-exposer.d.ts +0 -35
- package/src/api/api-exposer/api-exposer.js +0 -38
- package/src/api/api-exposer/decorators.d.ts +0 -10
- package/src/api/api-exposer/decorators.js +0 -18
- package/src/api/api-exposer/index.d.ts +0 -4
- package/src/api/api-exposer/index.js +0 -20
- package/src/api/api-exposer/strategies/index.d.ts +0 -1
- package/src/api/api-exposer/strategies/index.js +0 -17
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
- package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
- package/src/api/application/Factory.d.ts +0 -196
- package/src/api/application/Factory.js +0 -278
- package/src/api/application/Instance.d.ts +0 -692
- package/src/api/application/Instance.js +0 -821
- package/src/api/application/index.d.ts +0 -12
- package/src/api/application/index.js +0 -28
- package/src/api/base.d.ts +0 -117
- package/src/api/base.js +0 -246
- package/src/api/clipboard/index.d.ts +0 -172
- package/src/api/clipboard/index.js +0 -200
- package/src/api/events/application.d.ts +0 -158
- package/src/api/events/application.js +0 -14
- package/src/api/events/base.d.ts +0 -42
- package/src/api/events/base.js +0 -2
- package/src/api/events/channel.d.ts +0 -35
- package/src/api/events/channel.js +0 -7
- package/src/api/events/emitterMap.d.ts +0 -11
- package/src/api/events/emitterMap.js +0 -35
- package/src/api/events/eventAggregator.d.ts +0 -5
- package/src/api/events/eventAggregator.js +0 -35
- package/src/api/events/externalApplication.d.ts +0 -24
- package/src/api/events/externalApplication.js +0 -7
- package/src/api/events/frame.d.ts +0 -35
- package/src/api/events/frame.js +0 -2
- package/src/api/events/globalHotkey.d.ts +0 -25
- package/src/api/events/globalHotkey.js +0 -2
- package/src/api/events/platform.d.ts +0 -34
- package/src/api/events/platform.js +0 -10
- package/src/api/events/system.d.ts +0 -126
- package/src/api/events/system.js +0 -15
- package/src/api/events/typedEventEmitter.d.ts +0 -20
- package/src/api/events/typedEventEmitter.js +0 -2
- package/src/api/events/view.d.ts +0 -92
- package/src/api/events/view.js +0 -12
- package/src/api/events/webcontents.d.ts +0 -277
- package/src/api/events/webcontents.js +0 -13
- package/src/api/events/window.d.ts +0 -421
- package/src/api/events/window.js +0 -12
- package/src/api/external-application/Factory.d.ts +0 -34
- package/src/api/external-application/Factory.js +0 -47
- package/src/api/external-application/Instance.d.ts +0 -110
- package/src/api/external-application/Instance.js +0 -117
- package/src/api/external-application/index.d.ts +0 -12
- package/src/api/external-application/index.js +0 -28
- package/src/api/fin.d.ts +0 -54
- package/src/api/fin.js +0 -45
- package/src/api/frame/Factory.d.ts +0 -54
- package/src/api/frame/Factory.js +0 -86
- package/src/api/frame/Instance.d.ts +0 -136
- package/src/api/frame/Instance.js +0 -143
- package/src/api/frame/index.d.ts +0 -14
- package/src/api/frame/index.js +0 -30
- package/src/api/global-hotkey/index.d.ts +0 -106
- package/src/api/global-hotkey/index.js +0 -132
- package/src/api/interappbus/channel/channel.d.ts +0 -285
- package/src/api/interappbus/channel/channel.js +0 -334
- package/src/api/interappbus/channel/channels-docs.d.ts +0 -342
- package/src/api/interappbus/channel/channels-docs.js +0 -401
- package/src/api/interappbus/channel/client.d.ts +0 -117
- package/src/api/interappbus/channel/client.js +0 -181
- package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
- package/src/api/interappbus/channel/connection-manager.js +0 -246
- package/src/api/interappbus/channel/index.d.ts +0 -189
- package/src/api/interappbus/channel/index.js +0 -333
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
- package/src/api/interappbus/channel/protocols/index.js +0 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
- package/src/api/interappbus/channel/protocols/strategy.js +0 -2
- package/src/api/interappbus/channel/provider.d.ts +0 -206
- package/src/api/interappbus/channel/provider.js +0 -338
- package/src/api/interappbus/index.d.ts +0 -120
- package/src/api/interappbus/index.js +0 -210
- package/src/api/interop/Factory.d.ts +0 -57
- package/src/api/interop/Factory.js +0 -96
- package/src/api/interop/InteropBroker.d.ts +0 -665
- package/src/api/interop/InteropBroker.js +0 -1313
- package/src/api/interop/InteropClient.d.ts +0 -502
- package/src/api/interop/InteropClient.js +0 -683
- package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
- package/src/api/interop/SessionContextGroupBroker.js +0 -108
- package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
- package/src/api/interop/SessionContextGroupClient.js +0 -86
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
- package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
- package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
- package/src/api/interop/fdc3/documentationStub.d.ts +0 -14
- package/src/api/interop/fdc3/documentationStub.js +0 -17
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -205
- package/src/api/interop/fdc3/fdc3-1.2.js +0 -435
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -298
- package/src/api/interop/fdc3/fdc3-2.0.js +0 -479
- package/src/api/interop/fdc3/fdc3.d.ts +0 -12
- package/src/api/interop/fdc3/fdc3.js +0 -35
- package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
- package/src/api/interop/fdc3/overrideCheck.js +0 -32
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
- package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
- package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
- package/src/api/interop/fdc3/utils.d.ts +0 -45
- package/src/api/interop/fdc3/utils.js +0 -239
- package/src/api/interop/fdc3/versions.d.ts +0 -1
- package/src/api/interop/fdc3/versions.js +0 -2
- package/src/api/interop/index.d.ts +0 -12
- package/src/api/interop/index.js +0 -28
- package/src/api/interop/utils.d.ts +0 -18
- package/src/api/interop/utils.js +0 -61
- package/src/api/me.d.ts +0 -40
- package/src/api/me.js +0 -134
- package/src/api/platform/Factory.d.ts +0 -171
- package/src/api/platform/Factory.js +0 -240
- package/src/api/platform/Instance.d.ts +0 -653
- package/src/api/platform/Instance.js +0 -834
- package/src/api/platform/common-utils.d.ts +0 -7
- package/src/api/platform/common-utils.js +0 -16
- package/src/api/platform/index.d.ts +0 -12
- package/src/api/platform/index.js +0 -28
- package/src/api/platform/layout/Factory.d.ts +0 -91
- package/src/api/platform/layout/Factory.js +0 -151
- package/src/api/platform/layout/Instance.d.ts +0 -192
- package/src/api/platform/layout/Instance.js +0 -224
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
- package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
- package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
- package/src/api/platform/layout/entities/layout-entities.d.ts +0 -427
- package/src/api/platform/layout/entities/layout-entities.js +0 -504
- package/src/api/platform/layout/entities/shapes.d.ts +0 -6
- package/src/api/platform/layout/entities/shapes.js +0 -2
- package/src/api/platform/layout/index.d.ts +0 -11
- package/src/api/platform/layout/index.js +0 -27
- package/src/api/platform/layout/layout.constants.d.ts +0 -1
- package/src/api/platform/layout/layout.constants.js +0 -4
- package/src/api/platform/layout/shapes.d.ts +0 -16
- package/src/api/platform/layout/shapes.js +0 -2
- package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
- package/src/api/platform/layout/utils/layout-traversal.js +0 -65
- package/src/api/platform/provider.d.ts +0 -510
- package/src/api/platform/provider.js +0 -2
- package/src/api/snapshot-source/Factory.d.ts +0 -53
- package/src/api/snapshot-source/Factory.js +0 -81
- package/src/api/snapshot-source/Instance.d.ts +0 -53
- package/src/api/snapshot-source/Instance.js +0 -154
- package/src/api/snapshot-source/index.d.ts +0 -12
- package/src/api/snapshot-source/index.js +0 -28
- package/src/api/snapshot-source/utils.d.ts +0 -2
- package/src/api/snapshot-source/utils.js +0 -6
- package/src/api/system/index.d.ts +0 -1468
- package/src/api/system/index.js +0 -1851
- package/src/api/view/Factory.d.ts +0 -88
- package/src/api/view/Factory.js +0 -141
- package/src/api/view/Instance.d.ts +0 -601
- package/src/api/view/Instance.js +0 -671
- package/src/api/view/index.d.ts +0 -12
- package/src/api/view/index.js +0 -28
- package/src/api/webcontents/main.d.ts +0 -922
- package/src/api/webcontents/main.js +0 -1046
- package/src/api/window/Factory.d.ts +0 -96
- package/src/api/window/Factory.js +0 -142
- package/src/api/window/Instance.d.ts +0 -1598
- package/src/api/window/Instance.js +0 -1851
- package/src/api/window/index.d.ts +0 -14
- package/src/api/window/index.js +0 -30
- package/src/browser.d.ts +0 -10
- package/src/browser.js +0 -36
- package/src/environment/browser.d.ts +0 -29
- package/src/environment/browser.js +0 -60
- package/src/environment/environment.d.ts +0 -33
- package/src/environment/environment.js +0 -4
- package/src/environment/mockEnvironment.d.ts +0 -27
- package/src/environment/mockEnvironment.js +0 -61
- package/src/environment/node-env.d.ts +0 -29
- package/src/environment/node-env.js +0 -72
- package/src/fdc3.d.ts +0 -3
- package/src/fdc3.js +0 -9
- package/src/mock.d.ts +0 -3
- package/src/mock.js +0 -18
- package/src/namespaces.d.ts +0 -22
- package/src/namespaces.js +0 -26
- package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
- package/src/shapes/ERROR_BOX_TYPES.js +0 -2
- package/src/shapes/WebOptions.d.ts +0 -13
- package/src/shapes/WebOptions.js +0 -2
- package/src/shapes/WindowOptions.d.ts +0 -43
- package/src/shapes/WindowOptions.js +0 -2
- package/src/shapes/protocol.d.ts +0 -204
- package/src/shapes/protocol.js +0 -2
- package/src/transport/mockWire.d.ts +0 -11
- package/src/transport/mockWire.js +0 -26
- package/src/transport/transport-errors.d.ts +0 -31
- package/src/transport/transport-errors.js +0 -79
- package/src/transport/transport.d.ts +0 -73
- package/src/transport/transport.js +0 -219
- package/src/transport/wire.d.ts +0 -77
- package/src/transport/wire.js +0 -36
- package/src/util/asyncFilter.d.ts +0 -1
- package/src/util/asyncFilter.js +0 -7
- package/src/util/channel-api-relay.d.ts +0 -13
- package/src/util/channel-api-relay.js +0 -47
- package/src/util/errors.d.ts +0 -10
- package/src/util/errors.js +0 -12
- package/src/util/exhaustive.d.ts +0 -1
- package/src/util/exhaustive.js +0 -7
- package/src/util/http.d.ts +0 -11
- package/src/util/http.js +0 -90
- package/src/util/inaccessibleObject.d.ts +0 -2
- package/src/util/inaccessibleObject.js +0 -49
- package/src/util/lazy.d.ts +0 -34
- package/src/util/lazy.js +0 -54
- package/src/util/normalize-config.d.ts +0 -3
- package/src/util/normalize-config.js +0 -52
- package/src/util/promises.d.ts +0 -5
- package/src/util/promises.js +0 -27
- package/src/util/ref-counter.d.ts +0 -7
- package/src/util/ref-counter.js +0 -52
- package/src/util/reversible-map.d.ts +0 -11
- package/src/util/reversible-map.js +0 -49
- package/src/util/runtimeVersioning.d.ts +0 -3
- package/src/util/runtimeVersioning.js +0 -25
- package/src/util/utilTypes.d.ts +0 -8
- package/src/util/utilTypes.js +0 -2
- package/src/util/validate.d.ts +0 -3
- package/src/util/validate.js +0 -11
|
@@ -1,821 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Application = void 0;
|
|
4
|
-
/* eslint-disable import/prefer-default-export */
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
const window_1 = require("../window");
|
|
7
|
-
const view_1 = require("../view");
|
|
8
|
-
/**
|
|
9
|
-
* An object representing an application. Allows the developer to create,
|
|
10
|
-
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
11
|
-
*/
|
|
12
|
-
class Application extends base_1.EmitterBase {
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
constructor(wire, identity) {
|
|
17
|
-
super(wire, 'application', identity.uuid);
|
|
18
|
-
this.identity = identity;
|
|
19
|
-
this.window = new window_1._Window(this.wire, {
|
|
20
|
-
uuid: this.identity.uuid,
|
|
21
|
-
name: this.identity.uuid
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
windowListFromIdentityList(identityList) {
|
|
25
|
-
const windowList = [];
|
|
26
|
-
identityList.forEach((identity) => {
|
|
27
|
-
windowList.push(new window_1._Window(this.wire, {
|
|
28
|
-
uuid: identity.uuid,
|
|
29
|
-
name: identity.name
|
|
30
|
-
}));
|
|
31
|
-
});
|
|
32
|
-
return windowList;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Adds a listener to the end of the listeners array for the specified event.
|
|
36
|
-
* @param eventType - The type of the event.
|
|
37
|
-
* @param listener - Called whenever an event of the specified type occurs.
|
|
38
|
-
* @param options - Option to support event timestamps.
|
|
39
|
-
*
|
|
40
|
-
* @function addListener
|
|
41
|
-
* @memberof Application
|
|
42
|
-
* @instance
|
|
43
|
-
* @tutorial Application.EventEmitter
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* Adds a listener to the end of the listeners array for the specified event.
|
|
47
|
-
* @param eventType - The type of the event.
|
|
48
|
-
* @param listener - Called whenever an event of the specified type occurs.
|
|
49
|
-
* @param options - Option to support event timestamps.
|
|
50
|
-
*
|
|
51
|
-
* @function on
|
|
52
|
-
* @memberof Application
|
|
53
|
-
* @instance
|
|
54
|
-
* @tutorial Application.EventEmitter
|
|
55
|
-
*/
|
|
56
|
-
/**
|
|
57
|
-
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
|
|
58
|
-
* @param eventType - The type of the event.
|
|
59
|
-
* @param listener - The callback function.
|
|
60
|
-
* @param options - Option to support event timestamps.
|
|
61
|
-
*
|
|
62
|
-
* @function once
|
|
63
|
-
* @memberof Application
|
|
64
|
-
* @instance
|
|
65
|
-
* @tutorial Application.EventEmitter
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* Adds a listener to the beginning of the listeners array for the specified event.
|
|
69
|
-
* @param eventType - The type of the event.
|
|
70
|
-
* @param listener - The callback function.
|
|
71
|
-
* @param options - Option to support event timestamps.
|
|
72
|
-
*
|
|
73
|
-
* @function prependListener
|
|
74
|
-
* @memberof Application
|
|
75
|
-
* @instance
|
|
76
|
-
* @tutorial Application.EventEmitter
|
|
77
|
-
*/
|
|
78
|
-
/**
|
|
79
|
-
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
|
|
80
|
-
* The listener is added to the beginning of the listeners array.
|
|
81
|
-
* @param eventType - The type of the event.
|
|
82
|
-
* @param listener - The callback function.
|
|
83
|
-
* @param options - Option to support event timestamps.
|
|
84
|
-
*
|
|
85
|
-
* @function prependOnceListener
|
|
86
|
-
* @memberof Application
|
|
87
|
-
* @instance
|
|
88
|
-
* @tutorial Application.EventEmitter
|
|
89
|
-
*/
|
|
90
|
-
/**
|
|
91
|
-
* Remove a listener from the listener array for the specified event.
|
|
92
|
-
* Caution: Calling this method changes the array indices in the listener array behind the listener.
|
|
93
|
-
* @param eventType - The type of the event.
|
|
94
|
-
* @param listener - The callback function.
|
|
95
|
-
* @param options - Option to support event timestamps.
|
|
96
|
-
*
|
|
97
|
-
* @function removeListener
|
|
98
|
-
* @memberof Application
|
|
99
|
-
* @instance
|
|
100
|
-
* @tutorial Application.EventEmitter
|
|
101
|
-
*/
|
|
102
|
-
/**
|
|
103
|
-
* Removes all listeners, or those of the specified event.
|
|
104
|
-
* @param eventType - The type of the event.
|
|
105
|
-
*
|
|
106
|
-
* @function removeAllListeners
|
|
107
|
-
* @memberof Application
|
|
108
|
-
* @instance
|
|
109
|
-
* @tutorial Application.EventEmitter
|
|
110
|
-
*/
|
|
111
|
-
/**
|
|
112
|
-
* JumpListCategory interface
|
|
113
|
-
* @typedef { object } JumpListCategory
|
|
114
|
-
* @property { string } name The display title for the category. If omitted, items in this category will be placed into the standard 'Tasks' category. There can be only one such category, and it will always be displayed at the bottom of the JumpList.
|
|
115
|
-
* @property { JumpListItem[] } items Array of JumpListItem objects
|
|
116
|
-
*/
|
|
117
|
-
/**
|
|
118
|
-
* @PORTED
|
|
119
|
-
* JumpListItem interface
|
|
120
|
-
* @typedef { object } JumpListItem
|
|
121
|
-
* @property { string } type One of the following: "task" or "separator". Defaults to task.
|
|
122
|
-
* @property { string } title The text to be displayed for the JumpList Item. Should only be set if type is "task".
|
|
123
|
-
* @property { string } description Description of the task (displayed in a tooltip). Should only be set if type is "task".
|
|
124
|
-
* @property { string } deepLink Deep link to a manifest, i.e: fins://path.to/manifest.json?$$param1=value1. See {@link https://developers.openfin.co/docs/deep-linking deep-linking} for more information.
|
|
125
|
-
* @property { string } iconPath The absolute path to an icon to be displayed for the item, which can be an arbitrary resource file that contains an icon (e.g. .ico, .exe, .dll).
|
|
126
|
-
* @property { number } iconIndex The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.
|
|
127
|
-
*/
|
|
128
|
-
/**
|
|
129
|
-
* Determines if the application is currently running.
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
*
|
|
133
|
-
* ```js
|
|
134
|
-
* async function isAppRunning() {
|
|
135
|
-
* const app = await fin.Application.getCurrent();
|
|
136
|
-
* return await app.isRunning();
|
|
137
|
-
* }
|
|
138
|
-
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
isRunning() {
|
|
142
|
-
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Closes the application and any child windows created by the application.
|
|
146
|
-
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
147
|
-
* @param force Close will be prevented from closing when force is false and
|
|
148
|
-
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
*
|
|
152
|
-
* ```js
|
|
153
|
-
* async function closeApp() {
|
|
154
|
-
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
155
|
-
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
156
|
-
* await app.quit();
|
|
157
|
-
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
158
|
-
*
|
|
159
|
-
* }
|
|
160
|
-
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
161
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
async quit(force = false) {
|
|
164
|
-
try {
|
|
165
|
-
await this._close(force);
|
|
166
|
-
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
167
|
-
}
|
|
168
|
-
catch (error) {
|
|
169
|
-
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
170
|
-
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
171
|
-
throw error;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
async _close(force = false) {
|
|
176
|
-
try {
|
|
177
|
-
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
if (!error.message.includes('Remote connection has closed')) {
|
|
181
|
-
throw error;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* @deprecated use Application.quit instead
|
|
187
|
-
* Closes the application and any child windows created by the application.
|
|
188
|
-
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
189
|
-
* @param callback - called if the method succeeds.
|
|
190
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
*
|
|
194
|
-
* ```js
|
|
195
|
-
* async function closeApp() {
|
|
196
|
-
* const app = await fin.Application.getCurrent();
|
|
197
|
-
* return await app.close();
|
|
198
|
-
* }
|
|
199
|
-
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
close(force = false) {
|
|
203
|
-
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
204
|
-
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
|
205
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
206
|
-
});
|
|
207
|
-
return this._close(force);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
211
|
-
*
|
|
212
|
-
* @example
|
|
213
|
-
*
|
|
214
|
-
* ```js
|
|
215
|
-
* async function getChildWindows() {
|
|
216
|
-
* const app = await fin.Application.getCurrent();
|
|
217
|
-
* return await app.getChildWindows();
|
|
218
|
-
* }
|
|
219
|
-
*
|
|
220
|
-
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
getChildWindows() {
|
|
224
|
-
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
225
|
-
const identityList = [];
|
|
226
|
-
payload.data.forEach((winName) => {
|
|
227
|
-
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
228
|
-
});
|
|
229
|
-
return this.windowListFromIdentityList(identityList);
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
234
|
-
* if the application was not created from a manifest.
|
|
235
|
-
*
|
|
236
|
-
* @example
|
|
237
|
-
*
|
|
238
|
-
* ```js
|
|
239
|
-
* async function getManifest() {
|
|
240
|
-
* const app = await fin.Application.getCurrent();
|
|
241
|
-
* return await app.getManifest();
|
|
242
|
-
* }
|
|
243
|
-
*
|
|
244
|
-
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
245
|
-
* ```
|
|
246
|
-
*/
|
|
247
|
-
getManifest() {
|
|
248
|
-
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
252
|
-
* if the application was created from a manifest.
|
|
253
|
-
*
|
|
254
|
-
* @example
|
|
255
|
-
*
|
|
256
|
-
* ```js
|
|
257
|
-
* async function getParentUuid() {
|
|
258
|
-
* const app = await fin.Application.start({
|
|
259
|
-
* uuid: 'app-1',
|
|
260
|
-
* name: 'myApp',
|
|
261
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
262
|
-
* autoShow: true
|
|
263
|
-
* });
|
|
264
|
-
* return await app.getParentUuid();
|
|
265
|
-
* }
|
|
266
|
-
*
|
|
267
|
-
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
268
|
-
* ```
|
|
269
|
-
*/
|
|
270
|
-
getParentUuid() {
|
|
271
|
-
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Retrieves current application's shortcut configuration.
|
|
275
|
-
*
|
|
276
|
-
* @example
|
|
277
|
-
*
|
|
278
|
-
* ```js
|
|
279
|
-
* async function getShortcuts() {
|
|
280
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
281
|
-
* return await app.getShortcuts();
|
|
282
|
-
* }
|
|
283
|
-
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
284
|
-
* ```
|
|
285
|
-
*/
|
|
286
|
-
getShortcuts() {
|
|
287
|
-
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Retrieves current application's views.
|
|
291
|
-
* @experimental
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
*
|
|
295
|
-
* ```js
|
|
296
|
-
* async function getViews() {
|
|
297
|
-
* const app = await fin.Application.getCurrent();
|
|
298
|
-
* return await app.getViews();
|
|
299
|
-
* }
|
|
300
|
-
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
301
|
-
* ```
|
|
302
|
-
*/
|
|
303
|
-
async getViews() {
|
|
304
|
-
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
305
|
-
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Returns the current zoom level of the application.
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
*
|
|
312
|
-
* ```js
|
|
313
|
-
* async function getZoomLevel() {
|
|
314
|
-
* const app = await fin.Application.getCurrent();
|
|
315
|
-
* return await app.getZoomLevel();
|
|
316
|
-
* }
|
|
317
|
-
*
|
|
318
|
-
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
319
|
-
* ```
|
|
320
|
-
*/
|
|
321
|
-
getZoomLevel() {
|
|
322
|
-
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Returns an instance of the main Window of the application
|
|
326
|
-
*
|
|
327
|
-
* @example
|
|
328
|
-
*
|
|
329
|
-
* ```js
|
|
330
|
-
* async function getWindow() {
|
|
331
|
-
* const app = await fin.Application.start({
|
|
332
|
-
* uuid: 'app-1',
|
|
333
|
-
* name: 'myApp',
|
|
334
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
335
|
-
* autoShow: true
|
|
336
|
-
* });
|
|
337
|
-
* return await app.getWindow();
|
|
338
|
-
* }
|
|
339
|
-
*
|
|
340
|
-
* getWindow().then(win => {
|
|
341
|
-
* win.showAt(0, 400);
|
|
342
|
-
* win.flash();
|
|
343
|
-
* }).catch(err => console.log(err));
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
getWindow() {
|
|
347
|
-
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
|
348
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
349
|
-
});
|
|
350
|
-
return Promise.resolve(this.window);
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
354
|
-
* @param userName - username to be passed to the RVM.
|
|
355
|
-
* @param appName - app name to be passed to the RVM.
|
|
356
|
-
*
|
|
357
|
-
* @example
|
|
358
|
-
*
|
|
359
|
-
* ```js
|
|
360
|
-
* async function registerUser() {
|
|
361
|
-
* const app = await fin.Application.getCurrent();
|
|
362
|
-
* return await app.registerUser('user', 'myApp');
|
|
363
|
-
* }
|
|
364
|
-
*
|
|
365
|
-
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
366
|
-
* ```
|
|
367
|
-
*/
|
|
368
|
-
registerUser(userName, appName) {
|
|
369
|
-
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Removes the application’s icon from the tray.
|
|
373
|
-
*
|
|
374
|
-
* @example
|
|
375
|
-
*
|
|
376
|
-
* ```js
|
|
377
|
-
* async function removeTrayIcon() {
|
|
378
|
-
* const app = await fin.Application.getCurrent();
|
|
379
|
-
* return await app.removeTrayIcon();
|
|
380
|
-
* }
|
|
381
|
-
*
|
|
382
|
-
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
383
|
-
* ```
|
|
384
|
-
*/
|
|
385
|
-
removeTrayIcon() {
|
|
386
|
-
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Restarts the application.
|
|
390
|
-
*
|
|
391
|
-
* @example
|
|
392
|
-
*
|
|
393
|
-
* ```js
|
|
394
|
-
* async function restartApp() {
|
|
395
|
-
* const app = await fin.Application.getCurrent();
|
|
396
|
-
* return await app.restart();
|
|
397
|
-
* }
|
|
398
|
-
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
399
|
-
* ```
|
|
400
|
-
*/
|
|
401
|
-
restart() {
|
|
402
|
-
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* DEPRECATED method to run the application.
|
|
406
|
-
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
407
|
-
*
|
|
408
|
-
* @example
|
|
409
|
-
*
|
|
410
|
-
* ```js
|
|
411
|
-
* async function run() {
|
|
412
|
-
* const app = await fin.Application.create({
|
|
413
|
-
* name: 'myApp',
|
|
414
|
-
* uuid: 'app-1',
|
|
415
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
416
|
-
* autoShow: true
|
|
417
|
-
* });
|
|
418
|
-
* await app.run();
|
|
419
|
-
* }
|
|
420
|
-
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
421
|
-
* ```
|
|
422
|
-
*
|
|
423
|
-
* @ignore
|
|
424
|
-
*/
|
|
425
|
-
run() {
|
|
426
|
-
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
427
|
-
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
|
428
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
429
|
-
});
|
|
430
|
-
return this._run();
|
|
431
|
-
}
|
|
432
|
-
_run(opts = {}) {
|
|
433
|
-
return this.wire
|
|
434
|
-
.sendAction('run-application', {
|
|
435
|
-
manifestUrl: this._manifestUrl,
|
|
436
|
-
opts,
|
|
437
|
-
...this.identity
|
|
438
|
-
})
|
|
439
|
-
.then(() => undefined);
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Instructs the RVM to schedule one restart of the application.
|
|
443
|
-
*
|
|
444
|
-
* @example
|
|
445
|
-
*
|
|
446
|
-
* ```js
|
|
447
|
-
* async function scheduleRestart() {
|
|
448
|
-
* const app = await fin.Application.getCurrent();
|
|
449
|
-
* return await app.scheduleRestart();
|
|
450
|
-
* }
|
|
451
|
-
*
|
|
452
|
-
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
453
|
-
* ```
|
|
454
|
-
*/
|
|
455
|
-
scheduleRestart() {
|
|
456
|
-
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Sends a message to the RVM to upload the application's logs. On success,
|
|
460
|
-
* an object containing logId is returned.
|
|
461
|
-
*
|
|
462
|
-
* @example
|
|
463
|
-
*
|
|
464
|
-
* ```js
|
|
465
|
-
* async function sendLog() {
|
|
466
|
-
* const app = await fin.Application.getCurrent();
|
|
467
|
-
* return await app.sendApplicationLog();
|
|
468
|
-
* }
|
|
469
|
-
*
|
|
470
|
-
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
471
|
-
* ```
|
|
472
|
-
*/
|
|
473
|
-
async sendApplicationLog() {
|
|
474
|
-
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
475
|
-
return payload.data;
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
479
|
-
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
480
|
-
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
481
|
-
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
* @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).
|
|
485
|
-
*
|
|
486
|
-
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
487
|
-
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
488
|
-
*
|
|
489
|
-
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
490
|
-
*
|
|
491
|
-
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
492
|
-
* uuid or shortcut.name is changed.
|
|
493
|
-
*
|
|
494
|
-
* @example
|
|
495
|
-
*
|
|
496
|
-
* ```js
|
|
497
|
-
* const app = fin.Application.getCurrentSync();
|
|
498
|
-
* const appName = 'My App';
|
|
499
|
-
* const jumpListConfig = [ // array of JumpList categories
|
|
500
|
-
* {
|
|
501
|
-
* // has no name and no type so `type` is assumed to be "tasks"
|
|
502
|
-
* items: [ // array of JumpList items
|
|
503
|
-
* {
|
|
504
|
-
* type: 'task',
|
|
505
|
-
* title: `Launch ${appName}`,
|
|
506
|
-
* description: `Runs ${appName} with the default configuration`,
|
|
507
|
-
* deepLink: 'fins://path.to/app/manifest.json',
|
|
508
|
-
* iconPath: 'https://path.to/app/icon.ico',
|
|
509
|
-
* iconIndex: 0
|
|
510
|
-
* },
|
|
511
|
-
* { type: 'separator' },
|
|
512
|
-
* {
|
|
513
|
-
* type: 'task',
|
|
514
|
-
* title: `Restore ${appName}`,
|
|
515
|
-
* description: 'Restore to last configuration',
|
|
516
|
-
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
517
|
-
* iconPath: 'https://path.to/app/icon.ico',
|
|
518
|
-
* iconIndex: 0
|
|
519
|
-
* },
|
|
520
|
-
* ]
|
|
521
|
-
* },
|
|
522
|
-
* {
|
|
523
|
-
* name: 'Tools',
|
|
524
|
-
* items: [ // array of JumpList items
|
|
525
|
-
* {
|
|
526
|
-
* type: 'task',
|
|
527
|
-
* title: 'Tool A',
|
|
528
|
-
* description: 'Runs Tool A',
|
|
529
|
-
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
530
|
-
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
531
|
-
* iconIndex: 0
|
|
532
|
-
* },
|
|
533
|
-
* {
|
|
534
|
-
* type: 'task',
|
|
535
|
-
* title: 'Tool B',
|
|
536
|
-
* description: 'Runs Tool B',
|
|
537
|
-
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
538
|
-
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
539
|
-
* iconIndex: 0
|
|
540
|
-
* }]
|
|
541
|
-
* }
|
|
542
|
-
* ];
|
|
543
|
-
*
|
|
544
|
-
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
545
|
-
* ```
|
|
546
|
-
*
|
|
547
|
-
* To handle deeplink args:
|
|
548
|
-
* ```js
|
|
549
|
-
* function handleUseLastConfiguration() {
|
|
550
|
-
* // this handler is called when the app is being launched
|
|
551
|
-
* app.on('run-requested', event => {
|
|
552
|
-
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
553
|
-
* // your logic here
|
|
554
|
-
* }
|
|
555
|
-
* });
|
|
556
|
-
* // this handler is called when the app was already running when the launch was requested
|
|
557
|
-
* fin.desktop.main(function(args) {
|
|
558
|
-
* if(args && args['use-last-configuration']) {
|
|
559
|
-
* // your logic here
|
|
560
|
-
* }
|
|
561
|
-
* });
|
|
562
|
-
* }
|
|
563
|
-
* ```
|
|
564
|
-
*/
|
|
565
|
-
async setJumpList(jumpListCategories) {
|
|
566
|
-
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
570
|
-
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
571
|
-
*
|
|
572
|
-
* @example
|
|
573
|
-
*
|
|
574
|
-
* ```js
|
|
575
|
-
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
576
|
-
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
577
|
-
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
578
|
-
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
579
|
-
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
580
|
-
*
|
|
581
|
-
* async function setTrayIcon(icon) {
|
|
582
|
-
* const app = await fin.Application.getCurrent();
|
|
583
|
-
* return await app.setTrayIcon(icon);
|
|
584
|
-
* }
|
|
585
|
-
*
|
|
586
|
-
* // use image url to set tray icon
|
|
587
|
-
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
588
|
-
*
|
|
589
|
-
* // use base64 encoded string to set tray icon
|
|
590
|
-
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
591
|
-
*
|
|
592
|
-
* // use a dataURL to set tray icon
|
|
593
|
-
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
594
|
-
* ```
|
|
595
|
-
*/
|
|
596
|
-
setTrayIcon(icon) {
|
|
597
|
-
return this.wire
|
|
598
|
-
.sendAction('set-tray-icon', {
|
|
599
|
-
enabledIcon: icon,
|
|
600
|
-
...this.identity
|
|
601
|
-
})
|
|
602
|
-
.then(() => undefined);
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* Sets new application's shortcut configuration. Windows only.
|
|
606
|
-
* @param config New application's shortcut configuration.
|
|
607
|
-
*
|
|
608
|
-
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
609
|
-
* to be able to change shortcut states.
|
|
610
|
-
*
|
|
611
|
-
* @example
|
|
612
|
-
*
|
|
613
|
-
* ```js
|
|
614
|
-
* async function setShortcuts(config) {
|
|
615
|
-
* const app = await fin.Application.getCurrent();
|
|
616
|
-
* return app.setShortcuts(config);
|
|
617
|
-
* }
|
|
618
|
-
*
|
|
619
|
-
* setShortcuts({
|
|
620
|
-
* desktop: true,
|
|
621
|
-
* startMenu: false,
|
|
622
|
-
* systemStartup: true
|
|
623
|
-
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
624
|
-
* ```
|
|
625
|
-
*/
|
|
626
|
-
setShortcuts(config) {
|
|
627
|
-
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
631
|
-
* @param queryString The new query string for this app's shortcuts.
|
|
632
|
-
*
|
|
633
|
-
* @example
|
|
634
|
-
*
|
|
635
|
-
* ```js
|
|
636
|
-
* const newQueryArgs = 'arg=true&arg2=false';
|
|
637
|
-
* const app = await fin.Application.getCurrent();
|
|
638
|
-
* try {
|
|
639
|
-
* await app.setShortcutQueryParams(newQueryArgs);
|
|
640
|
-
* } catch(err) {
|
|
641
|
-
* console.error(err)
|
|
642
|
-
* }
|
|
643
|
-
* ```
|
|
644
|
-
*/
|
|
645
|
-
async setShortcutQueryParams(queryString) {
|
|
646
|
-
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
650
|
-
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
651
|
-
* @param level The zoom level
|
|
652
|
-
*
|
|
653
|
-
* @example
|
|
654
|
-
*
|
|
655
|
-
* ```js
|
|
656
|
-
* async function setZoomLevel(number) {
|
|
657
|
-
* const app = await fin.Application.getCurrent();
|
|
658
|
-
* return await app.setZoomLevel(number);
|
|
659
|
-
* }
|
|
660
|
-
*
|
|
661
|
-
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
662
|
-
* ```
|
|
663
|
-
*/
|
|
664
|
-
setZoomLevel(level) {
|
|
665
|
-
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
* Sets a username to correlate with App Log Management.
|
|
669
|
-
* @param username Username to correlate with App's Log.
|
|
670
|
-
*
|
|
671
|
-
* @example
|
|
672
|
-
*
|
|
673
|
-
* ```js
|
|
674
|
-
* async function setAppLogUser() {
|
|
675
|
-
* const app = await fin.Application.getCurrent();
|
|
676
|
-
* return await app.setAppLogUsername('username');
|
|
677
|
-
* }
|
|
678
|
-
*
|
|
679
|
-
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
680
|
-
*
|
|
681
|
-
* ```
|
|
682
|
-
*/
|
|
683
|
-
async setAppLogUsername(username) {
|
|
684
|
-
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
685
|
-
}
|
|
686
|
-
/**
|
|
687
|
-
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
688
|
-
* @remarks The only information currently returned is the position and dimensions.
|
|
689
|
-
*
|
|
690
|
-
* @example
|
|
691
|
-
*
|
|
692
|
-
* ```js
|
|
693
|
-
* async function getTrayIconInfo() {
|
|
694
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
695
|
-
* return await app.getTrayIconInfo();
|
|
696
|
-
* }
|
|
697
|
-
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
698
|
-
* ```
|
|
699
|
-
*/
|
|
700
|
-
getTrayIconInfo() {
|
|
701
|
-
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Checks if the application has an associated tray icon.
|
|
705
|
-
*
|
|
706
|
-
* @example
|
|
707
|
-
*
|
|
708
|
-
* ```js
|
|
709
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
710
|
-
* const hasTrayIcon = await app.hasTrayIcon();
|
|
711
|
-
* console.log(hasTrayIcon);
|
|
712
|
-
* ```
|
|
713
|
-
*/
|
|
714
|
-
hasTrayIcon() {
|
|
715
|
-
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Closes the application by terminating its process.
|
|
719
|
-
*
|
|
720
|
-
* @example
|
|
721
|
-
*
|
|
722
|
-
* ```js
|
|
723
|
-
* async function terminateApp() {
|
|
724
|
-
* const app = await fin.Application.getCurrent();
|
|
725
|
-
* return await app.terminate();
|
|
726
|
-
* }
|
|
727
|
-
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
728
|
-
* ```
|
|
729
|
-
*/
|
|
730
|
-
terminate() {
|
|
731
|
-
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Waits for a hanging application. This method can be called in response to an application
|
|
735
|
-
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
736
|
-
* message after a certain period of time.
|
|
737
|
-
*
|
|
738
|
-
* @ignore
|
|
739
|
-
*/
|
|
740
|
-
wait() {
|
|
741
|
-
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* Retrieves information about the application.
|
|
745
|
-
*
|
|
746
|
-
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
747
|
-
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
748
|
-
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
749
|
-
*
|
|
750
|
-
* @example
|
|
751
|
-
*
|
|
752
|
-
* ```js
|
|
753
|
-
* async function getInfo() {
|
|
754
|
-
* const app = await fin.Application.getCurrent();
|
|
755
|
-
* return await app.getInfo();
|
|
756
|
-
* }
|
|
757
|
-
*
|
|
758
|
-
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
759
|
-
* ```
|
|
760
|
-
*/
|
|
761
|
-
getInfo() {
|
|
762
|
-
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
766
|
-
*
|
|
767
|
-
* @example
|
|
768
|
-
* ```js
|
|
769
|
-
* const app = await fin.Application.getCurrent();
|
|
770
|
-
* const processInfo = await app.getProcessInfo();
|
|
771
|
-
* ```
|
|
772
|
-
* @experimental
|
|
773
|
-
*/
|
|
774
|
-
async getProcessInfo() {
|
|
775
|
-
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
776
|
-
return data;
|
|
777
|
-
}
|
|
778
|
-
/**
|
|
779
|
-
* Sets file auto download location. It's only allowed in the same application.
|
|
780
|
-
* Note: This method is restricted by default and must be enabled via
|
|
781
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
782
|
-
* @param downloadLocation file auto download location
|
|
783
|
-
*
|
|
784
|
-
* @throws if setting file auto download location on different applications.
|
|
785
|
-
* @example
|
|
786
|
-
*
|
|
787
|
-
* ```js
|
|
788
|
-
* const downloadLocation = 'C:\\dev\\temp';
|
|
789
|
-
* const app = await fin.Application.getCurrent();
|
|
790
|
-
* try {
|
|
791
|
-
* await app.setFileDownloadLocation(downloadLocation);
|
|
792
|
-
* console.log('File download location is set');
|
|
793
|
-
* } catch(err) {
|
|
794
|
-
* console.error(err)
|
|
795
|
-
* }
|
|
796
|
-
* ```
|
|
797
|
-
*/
|
|
798
|
-
async setFileDownloadLocation(downloadLocation) {
|
|
799
|
-
const { name } = this.wire.me;
|
|
800
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
801
|
-
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* 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.
|
|
805
|
-
* Note: This method is restricted by default and must be enabled via
|
|
806
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
807
|
-
*
|
|
808
|
-
* @throws if getting file auto download location on different applications.
|
|
809
|
-
* @example
|
|
810
|
-
*
|
|
811
|
-
* ```js
|
|
812
|
-
* const app = await fin.Application.getCurrent();
|
|
813
|
-
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
814
|
-
* ```
|
|
815
|
-
*/
|
|
816
|
-
async getFileDownloadLocation() {
|
|
817
|
-
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
818
|
-
return data;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
exports.Application = Application;
|