@openfin/core 25.68.30 → 25.70.2
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 +30 -826
- package/README.md +12 -2
- package/package.json +1 -1
- package/src/api/application/Factory.d.ts +145 -145
- package/src/api/application/Factory.js +229 -229
- package/src/api/application/Instance.d.ts +301 -302
- package/src/api/application/Instance.js +412 -412
- package/src/api/application/index.d.ts +3 -3
- package/src/api/application/index.js +15 -15
- package/src/api/base.d.ts +43 -43
- package/src/api/base.js +177 -177
- package/src/api/clipboard/index.d.ts +69 -69
- package/src/api/clipboard/index.js +88 -88
- package/src/api/events/application.d.ts +69 -0
- package/src/api/events/application.js +2 -0
- package/src/api/events/base.d.ts +17 -0
- package/src/api/events/base.js +2 -0
- package/src/api/events/channel.d.ts +10 -11
- package/src/api/events/channel.js +2 -2
- package/src/api/events/emitterMap.d.ts +11 -11
- package/src/api/events/emitterMap.js +35 -35
- package/src/api/events/eventAggregator.d.ts +5 -5
- package/src/api/events/eventAggregator.js +43 -43
- package/src/api/events/externalApplication.d.ts +5 -0
- package/src/api/events/externalApplication.js +2 -0
- package/src/api/events/frame.d.ts +9 -0
- package/src/api/events/frame.js +2 -0
- package/src/api/events/globalHotkey.d.ts +10 -0
- package/src/api/events/globalHotkey.js +2 -0
- package/src/api/events/platform.d.ts +18 -0
- package/src/api/events/platform.js +2 -0
- package/src/api/events/system.d.ts +22 -0
- package/src/api/events/system.js +2 -0
- package/src/api/events/view.d.ts +56 -0
- package/src/api/events/view.js +2 -0
- package/src/api/events/webcontents.d.ts +48 -0
- package/src/api/events/webcontents.js +2 -0
- package/src/api/events/window.d.ts +176 -0
- package/src/api/events/window.js +2 -0
- package/src/api/external-application/Factory.d.ts +26 -26
- package/src/api/external-application/Factory.js +40 -40
- package/src/api/external-application/Instance.d.ts +101 -102
- package/src/api/external-application/Instance.js +109 -109
- package/src/api/external-application/index.d.ts +3 -3
- package/src/api/external-application/index.js +15 -15
- package/src/api/fin.d.ts +49 -49
- package/src/api/fin.js +43 -43
- package/src/api/frame/Factory.d.ts +36 -36
- package/src/api/frame/Factory.js +69 -69
- package/src/api/frame/Instance.d.ts +121 -121
- package/src/api/frame/Instance.js +130 -130
- package/src/api/frame/index.d.ts +3 -3
- package/src/api/frame/index.js +15 -15
- package/src/api/global-hotkey/index.d.ts +38 -38
- package/src/api/global-hotkey/index.js +58 -58
- package/src/api/interappbus/channel/channel.d.ts +26 -26
- package/src/api/interappbus/channel/channel.js +77 -77
- package/src/api/interappbus/channel/channels-docs.d.ts +318 -318
- package/src/api/interappbus/channel/channels-docs.js +376 -376
- package/src/api/interappbus/channel/client.d.ts +22 -22
- package/src/api/interappbus/channel/client.js +84 -84
- package/src/api/interappbus/channel/connection-manager.d.ts +28 -28
- package/src/api/interappbus/channel/connection-manager.js +244 -244
- package/src/api/interappbus/channel/index.d.ts +22 -23
- package/src/api/interappbus/channel/index.js +121 -121
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -22
- package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -84
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +44 -44
- package/src/api/interappbus/channel/protocols/index.js +2 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -23
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -135
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -131
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -22
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -87
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +2 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -15
- package/src/api/interappbus/channel/protocols/strategy.js +2 -2
- package/src/api/interappbus/channel/provider.d.ts +31 -31
- package/src/api/interappbus/channel/provider.js +160 -160
- package/src/api/interappbus/index.d.ts +85 -86
- package/src/api/interappbus/index.js +175 -175
- package/src/api/interop/Factory.d.ts +37 -37
- package/src/api/interop/Factory.js +54 -54
- package/src/api/interop/InteropBroker.d.ts +363 -363
- package/src/api/interop/InteropBroker.js +914 -914
- package/src/api/interop/InteropClient.d.ts +268 -268
- package/src/api/interop/InteropClient.js +450 -450
- package/src/api/interop/SessionContextGroupBroker.d.ts +26 -26
- package/src/api/interop/SessionContextGroupBroker.js +107 -107
- package/src/api/interop/SessionContextGroupClient.d.ts +20 -20
- package/src/api/interop/SessionContextGroupClient.js +85 -85
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -187
- package/src/api/interop/fdc3/fdc3-1.2.js +385 -385
- package/src/api/interop/fdc3/fdc3.js +17 -17
- package/src/api/interop/fdc3/utils.d.ts +6 -6
- package/src/api/interop/fdc3/utils.js +17 -17
- package/src/api/interop/index.d.ts +4 -4
- package/src/api/interop/index.js +16 -16
- package/src/api/interop/utils.d.ts +11 -11
- package/src/api/interop/utils.js +36 -36
- package/src/api/me.d.ts +38 -35
- package/src/api/me.js +128 -60
- package/src/api/platform/Factory.d.ts +109 -109
- package/src/api/platform/Factory.js +188 -188
- package/src/api/platform/Instance.d.ts +122 -122
- package/src/api/platform/Instance.js +298 -298
- package/src/api/platform/common-utils.d.ts +6 -6
- package/src/api/platform/common-utils.js +16 -16
- package/src/api/platform/index.d.ts +3 -3
- package/src/api/platform/index.js +15 -15
- package/src/api/platform/layout/Factory.d.ts +108 -108
- package/src/api/platform/layout/Factory.js +189 -189
- package/src/api/platform/layout/Instance.d.ts +49 -49
- package/src/api/platform/layout/Instance.js +99 -99
- package/src/api/platform/layout/index.d.ts +2 -2
- package/src/api/platform/layout/index.js +14 -14
- package/src/api/platform/layout/shapes.d.ts +11 -0
- package/src/api/{window → platform/layout}/shapes.js +2 -2
- package/src/api/snapshot-source/Factory.d.ts +36 -36
- package/src/api/snapshot-source/Factory.js +65 -65
- package/src/api/snapshot-source/Instance.d.ts +30 -30
- package/src/api/snapshot-source/Instance.js +134 -134
- package/src/api/snapshot-source/index.d.ts +3 -3
- package/src/api/snapshot-source/index.js +15 -15
- package/src/api/snapshot-source/utils.d.ts +1 -1
- package/src/api/snapshot-source/utils.js +5 -5
- package/src/api/system/index.d.ts +960 -961
- package/src/api/system/index.js +1241 -1241
- package/src/api/view/Factory.d.ts +49 -49
- package/src/api/view/Factory.js +103 -103
- package/src/api/view/Instance.d.ts +387 -380
- package/src/api/view/Instance.js +422 -415
- package/src/api/view/index.d.ts +3 -3
- package/src/api/view/index.js +15 -15
- package/src/api/webcontents/main.d.ts +36 -36
- package/src/api/webcontents/main.js +82 -82
- package/src/api/window/Factory.d.ts +44 -44
- package/src/api/window/Factory.js +91 -91
- package/src/api/window/Instance.d.ts +972 -966
- package/src/api/window/Instance.js +1209 -1202
- package/src/api/window/index.d.ts +3 -5
- package/src/api/window/index.js +15 -17
- package/src/environment/environment.d.ts +28 -25
- package/src/environment/environment.js +4 -4
- package/src/environment/node-env.d.ts +25 -26
- package/src/environment/node-env.js +64 -64
- package/src/environment/openfin-env.d.ts +29 -30
- package/src/environment/openfin-env.js +107 -107
- package/src/mock.d.ts +3 -3
- package/src/mock.js +91 -90
- package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -0
- package/src/shapes/ERROR_BOX_TYPES.js +2 -0
- package/src/shapes/WebOptions.d.ts +12 -0
- package/src/shapes/WebOptions.js +2 -0
- package/src/shapes/WindowOptions.d.ts +42 -0
- package/src/shapes/WindowOptions.js +2 -0
- package/src/shapes/protocol.d.ts +178 -0
- package/src/shapes/protocol.js +2 -0
- package/src/transport/fin_store.d.ts +4 -4
- package/src/transport/fin_store.js +16 -16
- package/src/transport/transport-errors.d.ts +18 -18
- package/src/transport/transport-errors.js +37 -37
- package/src/transport/transport.d.ts +56 -43
- package/src/transport/transport.js +181 -181
- package/src/transport/wire.d.ts +71 -11
- package/src/transport/wire.js +32 -32
- package/src/util/asyncFilter.d.ts +1 -1
- package/src/util/asyncFilter.js +7 -7
- package/src/util/errors.d.ts +9 -5
- package/src/util/errors.js +11 -11
- package/src/util/exhaustive.d.ts +1 -1
- package/src/util/exhaustive.js +7 -7
- package/src/util/http.d.ts +11 -11
- package/src/util/http.js +83 -83
- package/src/util/normalize-config.d.ts +3 -5
- package/src/util/normalize-config.js +47 -47
- package/src/util/promises.d.ts +5 -5
- package/src/util/promises.js +27 -27
- package/src/util/ref-counter.d.ts +7 -7
- package/src/util/ref-counter.js +51 -51
- package/src/util/runtimeVersioning.d.ts +3 -3
- package/src/util/runtimeVersioning.js +25 -25
- package/src/util/utilTypes.d.ts +8 -8
- package/src/util/utilTypes.js +2 -2
- package/src/util/validate.d.ts +3 -3
- package/src/util/validate.js +11 -11
- package/docs.README(OLD).md +0 -82
- package/resources/win/OpenFinRVM.exe +0 -0
- package/src/api/window/bounds-changed.d.ts +0 -10
- package/src/api/window/bounds-changed.js +0 -6
- package/src/api/window/shapes.d.ts +0 -13
|
@@ -1,229 +1,229 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const base_1 = require("../base");
|
|
4
|
-
const validate_1 = require("../../util/validate");
|
|
5
|
-
const Instance_1 = require("./Instance");
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {object}
|
|
8
|
-
* @summary Application creation options.
|
|
9
|
-
* @desc This is the options object required by {@link Application.start Application.start}.
|
|
10
|
-
*
|
|
11
|
-
* The following options are required:
|
|
12
|
-
* * `uuid` is required in the app manifest as well as by {@link Application.start Application.start}
|
|
13
|
-
* * `name` is optional in the app manifest but required by {@link Application.start Application.start}
|
|
14
|
-
* * `url` is optional in both the app manifest {@link Application.start Application.start} and but is usually given
|
|
15
|
-
* (defaults to `"about:blank"` when omitted).
|
|
16
|
-
*
|
|
17
|
-
* _This jsdoc typedef mirrors the `ApplicationOption` TypeScript interface in `@types/openfin`._
|
|
18
|
-
*
|
|
19
|
-
* **IMPORTANT NOTE:**
|
|
20
|
-
* This object inherits all the properties of the window creation {@link Window~options options} object,
|
|
21
|
-
* which will take priority over those of the same name that may be provided in `mainWindowOptions`.
|
|
22
|
-
*
|
|
23
|
-
* @property {boolean} [disableIabSecureLogging=false]
|
|
24
|
-
* When set to `true` it will disable IAB secure logging for the app.
|
|
25
|
-
*
|
|
26
|
-
* @property {string} [loadErrorMessage="There was an error loading the application."]
|
|
27
|
-
* An error message to display when the application (launched via manifest) fails to load.
|
|
28
|
-
* A dialog box will be launched with the error message just before the runtime exits.
|
|
29
|
-
* Load fails such as failed DNS resolutions or aborted connections as well as cancellations, _e.g.,_ `window.stop()`,
|
|
30
|
-
* will trigger this dialog.
|
|
31
|
-
* Client response codes such as `404 Not Found` are not treated as fails as they are valid server responses.
|
|
32
|
-
*
|
|
33
|
-
* @property {Window~options} [mainWindowOptions]
|
|
34
|
-
* The options of the main window of the application.
|
|
35
|
-
* For a description of these options, click the link (in the Type column).
|
|
36
|
-
*
|
|
37
|
-
* @property {number} [maxViewPoolSize=1000]
|
|
38
|
-
* Platforms Only. The maximum number of "detached" or "pooled" Views that can exist in the Platform before being closed.
|
|
39
|
-
* If you do not wish for views to be pooled on your platform, set this property to zero.
|
|
40
|
-
*
|
|
41
|
-
* @property {boolean} [preventQuitOnLastWindowClosed=false]
|
|
42
|
-
* Platforms Only. Prevent the Platform Provider from quitting automatically when the last Platform Window is closed.
|
|
43
|
-
* Note: if the Platform Provider is showing, it won't close automatically.
|
|
44
|
-
* If you want a hidden Platform Provider to remain open after the last Platform Window has been closed, set this property to true.
|
|
45
|
-
*
|
|
46
|
-
* @property {string} [name]
|
|
47
|
-
* The name of the application (and the application's main window).
|
|
48
|
-
*
|
|
49
|
-
* If provided, _must_ match `uuid`.
|
|
50
|
-
*
|
|
51
|
-
* @property {boolean} [nonPersistent=false]
|
|
52
|
-
* A flag to configure the application as non-persistent.
|
|
53
|
-
* Runtime exits when there are no persistent apps running.
|
|
54
|
-
*
|
|
55
|
-
* @property {boolean} [plugins=false]
|
|
56
|
-
* Enable Flash at the application level.
|
|
57
|
-
*
|
|
58
|
-
* @property {boolean} [spellCheck=false]
|
|
59
|
-
* Enable spell check at the application level.
|
|
60
|
-
*
|
|
61
|
-
* @property {string} [url="about:blank"]
|
|
62
|
-
* The url to the application (specifically the application's main window).
|
|
63
|
-
*
|
|
64
|
-
* @property {boolean} [enableJumpList=false]
|
|
65
|
-
* Enables the use of the Jumplists API and the 'pin to taskbar' functionality.
|
|
66
|
-
* Only relevant in Windows.
|
|
67
|
-
*
|
|
68
|
-
* @property {string} uuid
|
|
69
|
-
* The _Unique Universal Identifier_ (UUID) of the application, unique within the set of all other applications
|
|
70
|
-
* running in the OpenFin Runtime.
|
|
71
|
-
*
|
|
72
|
-
* Note that `name` and `uuid` must match.
|
|
73
|
-
*
|
|
74
|
-
* @property {boolean} [webSecurity=true]
|
|
75
|
-
* When set to `false` it will disable the same-origin policy for the app.
|
|
76
|
-
*/
|
|
77
|
-
/**
|
|
78
|
-
* @lends Application
|
|
79
|
-
*/
|
|
80
|
-
class ApplicationModule extends base_1.Base {
|
|
81
|
-
/**
|
|
82
|
-
* Asynchronously returns an Application object that represents an existing application.
|
|
83
|
-
* @param { Identity } identity
|
|
84
|
-
* @return {Promise.<Application>}
|
|
85
|
-
* @tutorial Application.wrap
|
|
86
|
-
* @static
|
|
87
|
-
*/
|
|
88
|
-
async wrap(identity) {
|
|
89
|
-
this.wire.sendAction('wrap-application').catch((e) => {
|
|
90
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
91
|
-
});
|
|
92
|
-
const errorMsg = validate_1.validateIdentity(identity);
|
|
93
|
-
if (errorMsg) {
|
|
94
|
-
throw new Error(errorMsg);
|
|
95
|
-
}
|
|
96
|
-
return new Instance_1.Application(this.wire, identity);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Synchronously returns an Application object that represents an existing application.
|
|
100
|
-
* @param { Identity } identity
|
|
101
|
-
* @return {Application}
|
|
102
|
-
* @tutorial Application.wrapSync
|
|
103
|
-
* @static
|
|
104
|
-
*/
|
|
105
|
-
wrapSync(identity) {
|
|
106
|
-
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
|
107
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
108
|
-
});
|
|
109
|
-
const errorMsg = validate_1.validateIdentity(identity);
|
|
110
|
-
if (errorMsg) {
|
|
111
|
-
throw new Error(errorMsg);
|
|
112
|
-
}
|
|
113
|
-
return new Instance_1.Application(this.wire, identity);
|
|
114
|
-
}
|
|
115
|
-
async _create(appOptions) {
|
|
116
|
-
// set defaults:
|
|
117
|
-
if (appOptions.waitForPageLoad === undefined) {
|
|
118
|
-
appOptions.waitForPageLoad = false;
|
|
119
|
-
}
|
|
120
|
-
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
121
|
-
appOptions.autoShow = true;
|
|
122
|
-
}
|
|
123
|
-
await this.wire.sendAction('create-application', appOptions);
|
|
124
|
-
return this.wrap({ uuid: appOptions.uuid });
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* DEPRECATED method to create a new Application. Use {@link Application.start} instead.
|
|
128
|
-
* @param {
|
|
129
|
-
* @return {Promise.<Application>}
|
|
130
|
-
* @tutorial Application.create
|
|
131
|
-
* @ignore
|
|
132
|
-
*/
|
|
133
|
-
create(appOptions) {
|
|
134
|
-
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
135
|
-
this.wire.sendAction('application-create').catch((e) => {
|
|
136
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
137
|
-
});
|
|
138
|
-
return this._create(appOptions);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Creates and starts a new Application.
|
|
142
|
-
* @param {
|
|
143
|
-
* @return {Promise.<Application>}
|
|
144
|
-
* @tutorial Application.start
|
|
145
|
-
* @static
|
|
146
|
-
*/
|
|
147
|
-
async start(appOptions) {
|
|
148
|
-
this.wire.sendAction('start-application').catch((e) => {
|
|
149
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
150
|
-
});
|
|
151
|
-
const app = await this._create(appOptions);
|
|
152
|
-
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
153
|
-
return app;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
157
|
-
* Returns once the RVM is finished attempting to launch the applications.
|
|
158
|
-
* @param { Array.<ManifestInfo> } applications
|
|
159
|
-
* @return {Promise.<void>}
|
|
160
|
-
* @static
|
|
161
|
-
* @tutorial Application.startManyManifests
|
|
162
|
-
* @experimental
|
|
163
|
-
*/
|
|
164
|
-
async startManyManifests(applications) {
|
|
165
|
-
return this.wire.sendAction('run-applications', { applications }).then(() => undefined);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Asynchronously returns an Application object that represents the current application
|
|
169
|
-
* @return {Promise.<Application>}
|
|
170
|
-
* @tutorial Application.getCurrent
|
|
171
|
-
* @static
|
|
172
|
-
*/
|
|
173
|
-
getCurrent() {
|
|
174
|
-
this.wire.sendAction('get-current-application').catch((e) => {
|
|
175
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
176
|
-
});
|
|
177
|
-
return this.wrap({ uuid: this.wire.me.uuid });
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Synchronously returns an Application object that represents the current application
|
|
181
|
-
* @return {Application}
|
|
182
|
-
* @tutorial Application.getCurrentSync
|
|
183
|
-
* @static
|
|
184
|
-
*/
|
|
185
|
-
getCurrentSync() {
|
|
186
|
-
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
|
187
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
188
|
-
});
|
|
189
|
-
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Retrieves application's manifest and returns a running instance of the application.
|
|
193
|
-
* @param {string} manifestUrl - The URL of app's manifest.
|
|
194
|
-
* @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
|
|
195
|
-
* @return {Promise.<Application>}
|
|
196
|
-
* @tutorial Application.startFromManifest
|
|
197
|
-
* @static
|
|
198
|
-
*/
|
|
199
|
-
async startFromManifest(manifestUrl, opts) {
|
|
200
|
-
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
|
201
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
202
|
-
});
|
|
203
|
-
const app = await this._createFromManifest(manifestUrl);
|
|
204
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
205
|
-
// @ts-ignore using private method without warning.
|
|
206
|
-
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
207
|
-
return app;
|
|
208
|
-
}
|
|
209
|
-
createFromManifest(manifestUrl) {
|
|
210
|
-
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
211
|
-
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
|
212
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
213
|
-
});
|
|
214
|
-
return this._createFromManifest(manifestUrl);
|
|
215
|
-
}
|
|
216
|
-
_createFromManifest(manifestUrl) {
|
|
217
|
-
return this.wire
|
|
218
|
-
.sendAction('get-application-manifest', { manifestUrl })
|
|
219
|
-
.then(({ payload }) => {
|
|
220
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
221
|
-
return this.wrap({ uuid });
|
|
222
|
-
})
|
|
223
|
-
.then((app) => {
|
|
224
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
225
|
-
return app;
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
exports.default = ApplicationModule;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_1 = require("../base");
|
|
4
|
+
const validate_1 = require("../../util/validate");
|
|
5
|
+
const Instance_1 = require("./Instance");
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} ApplicationOptions
|
|
8
|
+
* @summary Application creation options.
|
|
9
|
+
* @desc This is the options object required by {@link Application.start Application.start}.
|
|
10
|
+
*
|
|
11
|
+
* The following options are required:
|
|
12
|
+
* * `uuid` is required in the app manifest as well as by {@link Application.start Application.start}
|
|
13
|
+
* * `name` is optional in the app manifest but required by {@link Application.start Application.start}
|
|
14
|
+
* * `url` is optional in both the app manifest {@link Application.start Application.start} and but is usually given
|
|
15
|
+
* (defaults to `"about:blank"` when omitted).
|
|
16
|
+
*
|
|
17
|
+
* _This jsdoc typedef mirrors the `ApplicationOption` TypeScript interface in `@types/openfin`._
|
|
18
|
+
*
|
|
19
|
+
* **IMPORTANT NOTE:**
|
|
20
|
+
* This object inherits all the properties of the window creation {@link Window~options options} object,
|
|
21
|
+
* which will take priority over those of the same name that may be provided in `mainWindowOptions`.
|
|
22
|
+
*
|
|
23
|
+
* @property {boolean} [disableIabSecureLogging=false]
|
|
24
|
+
* When set to `true` it will disable IAB secure logging for the app.
|
|
25
|
+
*
|
|
26
|
+
* @property {string} [loadErrorMessage="There was an error loading the application."]
|
|
27
|
+
* An error message to display when the application (launched via manifest) fails to load.
|
|
28
|
+
* A dialog box will be launched with the error message just before the runtime exits.
|
|
29
|
+
* Load fails such as failed DNS resolutions or aborted connections as well as cancellations, _e.g.,_ `window.stop()`,
|
|
30
|
+
* will trigger this dialog.
|
|
31
|
+
* Client response codes such as `404 Not Found` are not treated as fails as they are valid server responses.
|
|
32
|
+
*
|
|
33
|
+
* @property {Window~options} [mainWindowOptions]
|
|
34
|
+
* The options of the main window of the application.
|
|
35
|
+
* For a description of these options, click the link (in the Type column).
|
|
36
|
+
*
|
|
37
|
+
* @property {number} [maxViewPoolSize=1000]
|
|
38
|
+
* Platforms Only. The maximum number of "detached" or "pooled" Views that can exist in the Platform before being closed.
|
|
39
|
+
* If you do not wish for views to be pooled on your platform, set this property to zero.
|
|
40
|
+
*
|
|
41
|
+
* @property {boolean} [preventQuitOnLastWindowClosed=false]
|
|
42
|
+
* Platforms Only. Prevent the Platform Provider from quitting automatically when the last Platform Window is closed.
|
|
43
|
+
* Note: if the Platform Provider is showing, it won't close automatically.
|
|
44
|
+
* If you want a hidden Platform Provider to remain open after the last Platform Window has been closed, set this property to true.
|
|
45
|
+
*
|
|
46
|
+
* @property {string} [name]
|
|
47
|
+
* The name of the application (and the application's main window).
|
|
48
|
+
*
|
|
49
|
+
* If provided, _must_ match `uuid`.
|
|
50
|
+
*
|
|
51
|
+
* @property {boolean} [nonPersistent=false]
|
|
52
|
+
* A flag to configure the application as non-persistent.
|
|
53
|
+
* Runtime exits when there are no persistent apps running.
|
|
54
|
+
*
|
|
55
|
+
* @property {boolean} [plugins=false]
|
|
56
|
+
* Enable Flash at the application level.
|
|
57
|
+
*
|
|
58
|
+
* @property {boolean} [spellCheck=false]
|
|
59
|
+
* Enable spell check at the application level.
|
|
60
|
+
*
|
|
61
|
+
* @property {string} [url="about:blank"]
|
|
62
|
+
* The url to the application (specifically the application's main window).
|
|
63
|
+
*
|
|
64
|
+
* @property {boolean} [enableJumpList=false]
|
|
65
|
+
* Enables the use of the Jumplists API and the 'pin to taskbar' functionality.
|
|
66
|
+
* Only relevant in Windows.
|
|
67
|
+
*
|
|
68
|
+
* @property {string} uuid
|
|
69
|
+
* The _Unique Universal Identifier_ (UUID) of the application, unique within the set of all other applications
|
|
70
|
+
* running in the OpenFin Runtime.
|
|
71
|
+
*
|
|
72
|
+
* Note that `name` and `uuid` must match.
|
|
73
|
+
*
|
|
74
|
+
* @property {boolean} [webSecurity=true]
|
|
75
|
+
* When set to `false` it will disable the same-origin policy for the app.
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* @lends Application
|
|
79
|
+
*/
|
|
80
|
+
class ApplicationModule extends base_1.Base {
|
|
81
|
+
/**
|
|
82
|
+
* Asynchronously returns an Application object that represents an existing application.
|
|
83
|
+
* @param { Identity } identity
|
|
84
|
+
* @return {Promise.<Application>}
|
|
85
|
+
* @tutorial Application.wrap
|
|
86
|
+
* @static
|
|
87
|
+
*/
|
|
88
|
+
async wrap(identity) {
|
|
89
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
|
90
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
91
|
+
});
|
|
92
|
+
const errorMsg = validate_1.validateIdentity(identity);
|
|
93
|
+
if (errorMsg) {
|
|
94
|
+
throw new Error(errorMsg);
|
|
95
|
+
}
|
|
96
|
+
return new Instance_1.Application(this.wire, identity);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Synchronously returns an Application object that represents an existing application.
|
|
100
|
+
* @param { Identity } identity
|
|
101
|
+
* @return {Application}
|
|
102
|
+
* @tutorial Application.wrapSync
|
|
103
|
+
* @static
|
|
104
|
+
*/
|
|
105
|
+
wrapSync(identity) {
|
|
106
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
|
107
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
108
|
+
});
|
|
109
|
+
const errorMsg = validate_1.validateIdentity(identity);
|
|
110
|
+
if (errorMsg) {
|
|
111
|
+
throw new Error(errorMsg);
|
|
112
|
+
}
|
|
113
|
+
return new Instance_1.Application(this.wire, identity);
|
|
114
|
+
}
|
|
115
|
+
async _create(appOptions) {
|
|
116
|
+
// set defaults:
|
|
117
|
+
if (appOptions.waitForPageLoad === undefined) {
|
|
118
|
+
appOptions.waitForPageLoad = false;
|
|
119
|
+
}
|
|
120
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
121
|
+
appOptions.autoShow = true;
|
|
122
|
+
}
|
|
123
|
+
await this.wire.sendAction('create-application', appOptions);
|
|
124
|
+
return this.wrap({ uuid: appOptions.uuid });
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* DEPRECATED method to create a new Application. Use {@link Application.start} instead.
|
|
128
|
+
* @param { ApplicationOptions } appOptions
|
|
129
|
+
* @return {Promise.<Application>}
|
|
130
|
+
* @tutorial Application.create
|
|
131
|
+
* @ignore
|
|
132
|
+
*/
|
|
133
|
+
create(appOptions) {
|
|
134
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
135
|
+
this.wire.sendAction('application-create').catch((e) => {
|
|
136
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
137
|
+
});
|
|
138
|
+
return this._create(appOptions);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Creates and starts a new Application.
|
|
142
|
+
* @param { ApplicationOptions } appOptions
|
|
143
|
+
* @return {Promise.<Application>}
|
|
144
|
+
* @tutorial Application.start
|
|
145
|
+
* @static
|
|
146
|
+
*/
|
|
147
|
+
async start(appOptions) {
|
|
148
|
+
this.wire.sendAction('start-application').catch((e) => {
|
|
149
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
150
|
+
});
|
|
151
|
+
const app = await this._create(appOptions);
|
|
152
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
153
|
+
return app;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
157
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
|
158
|
+
* @param { Array.<ManifestInfo> } applications
|
|
159
|
+
* @return {Promise.<void>}
|
|
160
|
+
* @static
|
|
161
|
+
* @tutorial Application.startManyManifests
|
|
162
|
+
* @experimental
|
|
163
|
+
*/
|
|
164
|
+
async startManyManifests(applications) {
|
|
165
|
+
return this.wire.sendAction('run-applications', { applications }).then(() => undefined);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Asynchronously returns an Application object that represents the current application
|
|
169
|
+
* @return {Promise.<Application>}
|
|
170
|
+
* @tutorial Application.getCurrent
|
|
171
|
+
* @static
|
|
172
|
+
*/
|
|
173
|
+
getCurrent() {
|
|
174
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
|
175
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
176
|
+
});
|
|
177
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Synchronously returns an Application object that represents the current application
|
|
181
|
+
* @return {Application}
|
|
182
|
+
* @tutorial Application.getCurrentSync
|
|
183
|
+
* @static
|
|
184
|
+
*/
|
|
185
|
+
getCurrentSync() {
|
|
186
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
|
187
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
188
|
+
});
|
|
189
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
|
193
|
+
* @param {string} manifestUrl - The URL of app's manifest.
|
|
194
|
+
* @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
|
|
195
|
+
* @return {Promise.<Application>}
|
|
196
|
+
* @tutorial Application.startFromManifest
|
|
197
|
+
* @static
|
|
198
|
+
*/
|
|
199
|
+
async startFromManifest(manifestUrl, opts) {
|
|
200
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
|
201
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
202
|
+
});
|
|
203
|
+
const app = await this._createFromManifest(manifestUrl);
|
|
204
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
205
|
+
// @ts-ignore using private method without warning.
|
|
206
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
207
|
+
return app;
|
|
208
|
+
}
|
|
209
|
+
createFromManifest(manifestUrl) {
|
|
210
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
211
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
|
212
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
213
|
+
});
|
|
214
|
+
return this._createFromManifest(manifestUrl);
|
|
215
|
+
}
|
|
216
|
+
_createFromManifest(manifestUrl) {
|
|
217
|
+
return this.wire
|
|
218
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
|
219
|
+
.then(({ payload }) => {
|
|
220
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
221
|
+
return this.wrap({ uuid });
|
|
222
|
+
})
|
|
223
|
+
.then((app) => {
|
|
224
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
225
|
+
return app;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
exports.default = ApplicationModule;
|