@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.
Files changed (199) hide show
  1. package/OpenFin.d.ts +30 -826
  2. package/README.md +12 -2
  3. package/package.json +1 -1
  4. package/src/api/application/Factory.d.ts +145 -145
  5. package/src/api/application/Factory.js +229 -229
  6. package/src/api/application/Instance.d.ts +301 -302
  7. package/src/api/application/Instance.js +412 -412
  8. package/src/api/application/index.d.ts +3 -3
  9. package/src/api/application/index.js +15 -15
  10. package/src/api/base.d.ts +43 -43
  11. package/src/api/base.js +177 -177
  12. package/src/api/clipboard/index.d.ts +69 -69
  13. package/src/api/clipboard/index.js +88 -88
  14. package/src/api/events/application.d.ts +69 -0
  15. package/src/api/events/application.js +2 -0
  16. package/src/api/events/base.d.ts +17 -0
  17. package/src/api/events/base.js +2 -0
  18. package/src/api/events/channel.d.ts +10 -11
  19. package/src/api/events/channel.js +2 -2
  20. package/src/api/events/emitterMap.d.ts +11 -11
  21. package/src/api/events/emitterMap.js +35 -35
  22. package/src/api/events/eventAggregator.d.ts +5 -5
  23. package/src/api/events/eventAggregator.js +43 -43
  24. package/src/api/events/externalApplication.d.ts +5 -0
  25. package/src/api/events/externalApplication.js +2 -0
  26. package/src/api/events/frame.d.ts +9 -0
  27. package/src/api/events/frame.js +2 -0
  28. package/src/api/events/globalHotkey.d.ts +10 -0
  29. package/src/api/events/globalHotkey.js +2 -0
  30. package/src/api/events/platform.d.ts +18 -0
  31. package/src/api/events/platform.js +2 -0
  32. package/src/api/events/system.d.ts +22 -0
  33. package/src/api/events/system.js +2 -0
  34. package/src/api/events/view.d.ts +56 -0
  35. package/src/api/events/view.js +2 -0
  36. package/src/api/events/webcontents.d.ts +48 -0
  37. package/src/api/events/webcontents.js +2 -0
  38. package/src/api/events/window.d.ts +176 -0
  39. package/src/api/events/window.js +2 -0
  40. package/src/api/external-application/Factory.d.ts +26 -26
  41. package/src/api/external-application/Factory.js +40 -40
  42. package/src/api/external-application/Instance.d.ts +101 -102
  43. package/src/api/external-application/Instance.js +109 -109
  44. package/src/api/external-application/index.d.ts +3 -3
  45. package/src/api/external-application/index.js +15 -15
  46. package/src/api/fin.d.ts +49 -49
  47. package/src/api/fin.js +43 -43
  48. package/src/api/frame/Factory.d.ts +36 -36
  49. package/src/api/frame/Factory.js +69 -69
  50. package/src/api/frame/Instance.d.ts +121 -121
  51. package/src/api/frame/Instance.js +130 -130
  52. package/src/api/frame/index.d.ts +3 -3
  53. package/src/api/frame/index.js +15 -15
  54. package/src/api/global-hotkey/index.d.ts +38 -38
  55. package/src/api/global-hotkey/index.js +58 -58
  56. package/src/api/interappbus/channel/channel.d.ts +26 -26
  57. package/src/api/interappbus/channel/channel.js +77 -77
  58. package/src/api/interappbus/channel/channels-docs.d.ts +318 -318
  59. package/src/api/interappbus/channel/channels-docs.js +376 -376
  60. package/src/api/interappbus/channel/client.d.ts +22 -22
  61. package/src/api/interappbus/channel/client.js +84 -84
  62. package/src/api/interappbus/channel/connection-manager.d.ts +28 -28
  63. package/src/api/interappbus/channel/connection-manager.js +244 -244
  64. package/src/api/interappbus/channel/index.d.ts +22 -23
  65. package/src/api/interappbus/channel/index.js +121 -121
  66. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -13
  67. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -73
  68. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -22
  69. package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -84
  70. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -20
  71. package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -58
  72. package/src/api/interappbus/channel/protocols/index.d.ts +44 -44
  73. package/src/api/interappbus/channel/protocols/index.js +2 -2
  74. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -10
  75. package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -43
  76. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -23
  77. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -135
  78. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -30
  79. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -131
  80. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -22
  81. package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -87
  82. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -13
  83. package/src/api/interappbus/channel/protocols/strategy-types.js +2 -2
  84. package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -15
  85. package/src/api/interappbus/channel/protocols/strategy.js +2 -2
  86. package/src/api/interappbus/channel/provider.d.ts +31 -31
  87. package/src/api/interappbus/channel/provider.js +160 -160
  88. package/src/api/interappbus/index.d.ts +85 -86
  89. package/src/api/interappbus/index.js +175 -175
  90. package/src/api/interop/Factory.d.ts +37 -37
  91. package/src/api/interop/Factory.js +54 -54
  92. package/src/api/interop/InteropBroker.d.ts +363 -363
  93. package/src/api/interop/InteropBroker.js +914 -914
  94. package/src/api/interop/InteropClient.d.ts +268 -268
  95. package/src/api/interop/InteropClient.js +450 -450
  96. package/src/api/interop/SessionContextGroupBroker.d.ts +26 -26
  97. package/src/api/interop/SessionContextGroupBroker.js +107 -107
  98. package/src/api/interop/SessionContextGroupClient.d.ts +20 -20
  99. package/src/api/interop/SessionContextGroupClient.js +85 -85
  100. package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -187
  101. package/src/api/interop/fdc3/fdc3-1.2.js +385 -385
  102. package/src/api/interop/fdc3/fdc3.js +17 -17
  103. package/src/api/interop/fdc3/utils.d.ts +6 -6
  104. package/src/api/interop/fdc3/utils.js +17 -17
  105. package/src/api/interop/index.d.ts +4 -4
  106. package/src/api/interop/index.js +16 -16
  107. package/src/api/interop/utils.d.ts +11 -11
  108. package/src/api/interop/utils.js +36 -36
  109. package/src/api/me.d.ts +38 -35
  110. package/src/api/me.js +128 -60
  111. package/src/api/platform/Factory.d.ts +109 -109
  112. package/src/api/platform/Factory.js +188 -188
  113. package/src/api/platform/Instance.d.ts +122 -122
  114. package/src/api/platform/Instance.js +298 -298
  115. package/src/api/platform/common-utils.d.ts +6 -6
  116. package/src/api/platform/common-utils.js +16 -16
  117. package/src/api/platform/index.d.ts +3 -3
  118. package/src/api/platform/index.js +15 -15
  119. package/src/api/platform/layout/Factory.d.ts +108 -108
  120. package/src/api/platform/layout/Factory.js +189 -189
  121. package/src/api/platform/layout/Instance.d.ts +49 -49
  122. package/src/api/platform/layout/Instance.js +99 -99
  123. package/src/api/platform/layout/index.d.ts +2 -2
  124. package/src/api/platform/layout/index.js +14 -14
  125. package/src/api/platform/layout/shapes.d.ts +11 -0
  126. package/src/api/{window → platform/layout}/shapes.js +2 -2
  127. package/src/api/snapshot-source/Factory.d.ts +36 -36
  128. package/src/api/snapshot-source/Factory.js +65 -65
  129. package/src/api/snapshot-source/Instance.d.ts +30 -30
  130. package/src/api/snapshot-source/Instance.js +134 -134
  131. package/src/api/snapshot-source/index.d.ts +3 -3
  132. package/src/api/snapshot-source/index.js +15 -15
  133. package/src/api/snapshot-source/utils.d.ts +1 -1
  134. package/src/api/snapshot-source/utils.js +5 -5
  135. package/src/api/system/index.d.ts +960 -961
  136. package/src/api/system/index.js +1241 -1241
  137. package/src/api/view/Factory.d.ts +49 -49
  138. package/src/api/view/Factory.js +103 -103
  139. package/src/api/view/Instance.d.ts +387 -380
  140. package/src/api/view/Instance.js +422 -415
  141. package/src/api/view/index.d.ts +3 -3
  142. package/src/api/view/index.js +15 -15
  143. package/src/api/webcontents/main.d.ts +36 -36
  144. package/src/api/webcontents/main.js +82 -82
  145. package/src/api/window/Factory.d.ts +44 -44
  146. package/src/api/window/Factory.js +91 -91
  147. package/src/api/window/Instance.d.ts +972 -966
  148. package/src/api/window/Instance.js +1209 -1202
  149. package/src/api/window/index.d.ts +3 -5
  150. package/src/api/window/index.js +15 -17
  151. package/src/environment/environment.d.ts +28 -25
  152. package/src/environment/environment.js +4 -4
  153. package/src/environment/node-env.d.ts +25 -26
  154. package/src/environment/node-env.js +64 -64
  155. package/src/environment/openfin-env.d.ts +29 -30
  156. package/src/environment/openfin-env.js +107 -107
  157. package/src/mock.d.ts +3 -3
  158. package/src/mock.js +91 -90
  159. package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -0
  160. package/src/shapes/ERROR_BOX_TYPES.js +2 -0
  161. package/src/shapes/WebOptions.d.ts +12 -0
  162. package/src/shapes/WebOptions.js +2 -0
  163. package/src/shapes/WindowOptions.d.ts +42 -0
  164. package/src/shapes/WindowOptions.js +2 -0
  165. package/src/shapes/protocol.d.ts +178 -0
  166. package/src/shapes/protocol.js +2 -0
  167. package/src/transport/fin_store.d.ts +4 -4
  168. package/src/transport/fin_store.js +16 -16
  169. package/src/transport/transport-errors.d.ts +18 -18
  170. package/src/transport/transport-errors.js +37 -37
  171. package/src/transport/transport.d.ts +56 -43
  172. package/src/transport/transport.js +181 -181
  173. package/src/transport/wire.d.ts +71 -11
  174. package/src/transport/wire.js +32 -32
  175. package/src/util/asyncFilter.d.ts +1 -1
  176. package/src/util/asyncFilter.js +7 -7
  177. package/src/util/errors.d.ts +9 -5
  178. package/src/util/errors.js +11 -11
  179. package/src/util/exhaustive.d.ts +1 -1
  180. package/src/util/exhaustive.js +7 -7
  181. package/src/util/http.d.ts +11 -11
  182. package/src/util/http.js +83 -83
  183. package/src/util/normalize-config.d.ts +3 -5
  184. package/src/util/normalize-config.js +47 -47
  185. package/src/util/promises.d.ts +5 -5
  186. package/src/util/promises.js +27 -27
  187. package/src/util/ref-counter.d.ts +7 -7
  188. package/src/util/ref-counter.js +51 -51
  189. package/src/util/runtimeVersioning.d.ts +3 -3
  190. package/src/util/runtimeVersioning.js +25 -25
  191. package/src/util/utilTypes.d.ts +8 -8
  192. package/src/util/utilTypes.js +2 -2
  193. package/src/util/validate.d.ts +3 -3
  194. package/src/util/validate.js +11 -11
  195. package/docs.README(OLD).md +0 -82
  196. package/resources/win/OpenFinRVM.exe +0 -0
  197. package/src/api/window/bounds-changed.d.ts +0 -10
  198. package/src/api/window/bounds-changed.js +0 -6
  199. package/src/api/window/shapes.d.ts +0 -13
@@ -1,412 +1,412 @@
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
- * @classdesc An object representing an application. Allows the developer to create,
10
- * execute, show/close an application as well as listen to <a href="tutorial-Application.EventEmitter.html">application events</a>.
11
- * @class
12
- * @hideconstructor
13
- */
14
- class Application extends base_1.EmitterBase {
15
- constructor(wire, identity) {
16
- super(wire, 'application', identity.uuid);
17
- this.identity = identity;
18
- this.window = new window_1._Window(this.wire, {
19
- uuid: this.identity.uuid,
20
- name: this.identity.uuid
21
- });
22
- }
23
- windowListFromIdentityList(identityList) {
24
- const windowList = [];
25
- identityList.forEach((identity) => {
26
- windowList.push(new window_1._Window(this.wire, {
27
- uuid: identity.uuid,
28
- name: identity.name
29
- }));
30
- });
31
- return windowList;
32
- }
33
- /**
34
- * Adds a listener to the end of the listeners array for the specified event.
35
- * @param { string | symbol } eventType - The type of the event.
36
- * @param { Function } listener - Called whenever an event of the specified type occurs.
37
- * @param { SubOptions } [options] - Option to support event timestamps.
38
- * @return {Promise.<this>}
39
- * @function addListener
40
- * @memberof Application
41
- * @instance
42
- * @tutorial Application.EventEmitter
43
- */
44
- /**
45
- * Adds a listener to the end of the listeners array for the specified event.
46
- * @param { string | symbol } eventType - The type of the event.
47
- * @param { Function } listener - Called whenever an event of the specified type occurs.
48
- * @param { SubOptions } [options] - Option to support event timestamps.
49
- * @return {Promise.<this>}
50
- * @function on
51
- * @memberof Application
52
- * @instance
53
- * @tutorial Application.EventEmitter
54
- */
55
- /**
56
- * 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.
57
- * @param { string | symbol } eventType - The type of the event.
58
- * @param { Function } listener - The callback function.
59
- * @param { SubOptions } [options] - Option to support event timestamps.
60
- * @return {Promise.<this>}
61
- * @function once
62
- * @memberof Application
63
- * @instance
64
- * @tutorial Application.EventEmitter
65
- */
66
- /**
67
- * Adds a listener to the beginning of the listeners array for the specified event.
68
- * @param { string | symbol } eventType - The type of the event.
69
- * @param { Function } listener - The callback function.
70
- * @param { SubOptions } [options] - Option to support event timestamps.
71
- * @return {Promise.<this>}
72
- * @function prependListener
73
- * @memberof Application
74
- * @instance
75
- * @tutorial Application.EventEmitter
76
- */
77
- /**
78
- * 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.
79
- * The listener is added to the beginning of the listeners array.
80
- * @param { string | symbol } eventType - The type of the event.
81
- * @param { Function } listener - The callback function.
82
- * @param { SubOptions } [options] - Option to support event timestamps.
83
- * @return {Promise.<this>}
84
- * @function prependOnceListener
85
- * @memberof Application
86
- * @instance
87
- * @tutorial Application.EventEmitter
88
- */
89
- /**
90
- * Remove a listener from the listener array for the specified event.
91
- * Caution: Calling this method changes the array indices in the listener array behind the listener.
92
- * @param { string | symbol } eventType - The type of the event.
93
- * @param { Function } listener - The callback function.
94
- * @param { SubOptions } [options] - Option to support event timestamps.
95
- * @return {Promise.<this>}
96
- * @function removeListener
97
- * @memberof Application
98
- * @instance
99
- * @tutorial Application.EventEmitter
100
- */
101
- /**
102
- * Removes all listeners, or those of the specified event.
103
- * @param { string | symbol } [eventType] - The type of the event.
104
- * @return {Promise.<this>}
105
- * @function removeAllListeners
106
- * @memberof Application
107
- * @instance
108
- * @tutorial Application.EventEmitter
109
- */
110
- /**
111
- * Determines if the application is currently running.
112
- * @return {Promise.<boolean>}
113
- * @tutorial Application.isRunning
114
- */
115
- /**
116
- * JumpListCategory interface
117
- * @typedef { object } JumpListCategory
118
- * @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.
119
- * @property { JumpListItem[] } items Array of JumpListItem objects
120
- */
121
- /**
122
- * JumpListItem interface
123
- * @typedef { object } JumpListItem
124
- * @property { string } type One of the following: "task" or "separator". Defaults to task.
125
- * @property { string } title The text to be displayed for the JumpList Item. Should only be set if type is "task".
126
- * @property { string } description Description of the task (displayed in a tooltip). Should only be set if type is "task".
127
- * @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.
128
- * @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).
129
- * @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.
130
- */
131
- isRunning() {
132
- return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
133
- }
134
- /**
135
- * Closes the application and any child windows created by the application.
136
- * Cleans the application from state so it is no longer found in getAllApplications.
137
- * @param { boolean } [force = false] Close will be prevented from closing when force is false and
138
- * ‘close-requested’ has been subscribed to for application’s main window.
139
- * @return {Promise.<boolean>}
140
- * @tutorial Application.quit
141
- */
142
- async quit(force = false) {
143
- await this._close(force);
144
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
145
- }
146
- _close(force = false) {
147
- return this.wire.sendAction('close-application', { force, ...this.identity }).then(() => undefined);
148
- }
149
- close(force = false) {
150
- console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
151
- this.wire.sendAction('application-close', this.identity).catch((e) => {
152
- // we do not want to expose this error, just continue if this analytics-only call fails
153
- });
154
- return this._close(force);
155
- }
156
- /**
157
- * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
158
- * @return {Promise.Array.<_Window>}
159
- * @tutorial Application.getChildWindows
160
- */
161
- getChildWindows() {
162
- return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
163
- const identityList = [];
164
- payload.data.forEach((winName) => {
165
- identityList.push({ uuid: this.identity.uuid, name: winName });
166
- });
167
- return this.windowListFromIdentityList(identityList);
168
- });
169
- }
170
- /**
171
- * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
172
- * if the application was not created from a manifest.
173
- * @return {Promise.<any>}
174
- * @tutorial Application.getManifest
175
- */
176
- getManifest() {
177
- return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
178
- }
179
- /**
180
- * Retrieves UUID of the application that launches this application. Invokes the error callback
181
- * if the application was created from a manifest.
182
- * @return {Promise.<string>}
183
- * @tutorial Application.getParentUuid
184
- */
185
- getParentUuid() {
186
- return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
187
- }
188
- /**
189
- * Retrieves current application's shortcut configuration.
190
- * @return {Promise.<ShortCutConfig>}
191
- * @tutorial Application.getShortcuts
192
- */
193
- getShortcuts() {
194
- return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
195
- }
196
- /**
197
- * Retrieves current application's views.
198
- * @experimental
199
- * @return {Promise.Array.<View>}
200
- * @tutorial Application.getViews
201
- */
202
- async getViews() {
203
- const { payload } = await this.wire.sendAction('application-get-views', this.identity);
204
- return payload.data.map((id) => new view_1.View(this.wire, id));
205
- }
206
- /**
207
- * Returns the current zoom level of the application.
208
- * @return {Promise.<number>}
209
- * @tutorial Application.getZoomLevel
210
- */
211
- getZoomLevel() {
212
- return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
213
- }
214
- /**
215
- * Returns an instance of the main Window of the application
216
- * @return {Promise.<_Window>}
217
- * @tutorial Application.getWindow
218
- */
219
- getWindow() {
220
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
221
- // we do not want to expose this error, just continue if this analytics-only call fails
222
- });
223
- return Promise.resolve(this.window);
224
- }
225
- /**
226
- * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
227
- * @param { string } userName - username to be passed to the RVM.
228
- * @param { string } appName - app name to be passed to the RVM.
229
- * @return {Promise.<void>}
230
- * @tutorial Application.registerUser
231
- */
232
- registerUser(userName, appName) {
233
- return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
234
- }
235
- /**
236
- * Removes the application’s icon from the tray.
237
- * @return {Promise.<void>}
238
- * @tutorial Application.removeTrayIcon
239
- */
240
- removeTrayIcon() {
241
- return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
242
- }
243
- /**
244
- * Restarts the application.
245
- * @return {Promise.<void>}
246
- * @tutorial Application.restart
247
- */
248
- restart() {
249
- return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
250
- }
251
- /**
252
- * DEPRECATED method to run the application.
253
- * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
254
- * @return {Promise.<void>}
255
- * @tutorial Application.run
256
- * @ignore
257
- */
258
- run() {
259
- console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
260
- this.wire.sendAction('application-run', this.identity).catch((e) => {
261
- // we do not want to expose this error, just continue if this analytics-only call fails
262
- });
263
- return this._run();
264
- }
265
- _run(opts = {}) {
266
- return this.wire
267
- .sendAction('run-application', {
268
- manifestUrl: this._manifestUrl,
269
- opts,
270
- ...this.identity
271
- })
272
- .then(() => undefined);
273
- }
274
- /**
275
- * Instructs the RVM to schedule one restart of the application.
276
- * @return {Promise.<void>}
277
- * @tutorial Application.scheduleRestart
278
- */
279
- scheduleRestart() {
280
- return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
281
- }
282
- /**
283
- * Sends a message to the RVM to upload the application's logs. On success,
284
- * an object containing logId is returned.
285
- * @return {Promise.<LogInfo>}
286
- * @tutorial Application.sendApplicationLog
287
- */
288
- async sendApplicationLog() {
289
- const { payload } = await this.wire.sendAction('send-application-log', this.identity);
290
- return payload.data;
291
- }
292
- /**
293
- * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
294
- * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
295
- * Note: If the "name" property is omitted it defaults to "tasks".
296
- * @param { Array.<JumpListCategory> | null } jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
297
- * @return { Promise.<void> }
298
- * @tutorial Application.setJumpList
299
- */
300
- async setJumpList(jumpListCategories) {
301
- await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
302
- }
303
- /**
304
- * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
305
- * @param { string } icon Image URL or base64 encoded string to be used as the icon
306
- * @return {Promise.<void>}
307
- * @tutorial Application.setTrayIcon
308
- */
309
- setTrayIcon(icon) {
310
- return this.wire
311
- .sendAction('set-tray-icon', {
312
- enabledIcon: icon,
313
- ...this.identity
314
- })
315
- .then(() => undefined);
316
- }
317
- /**
318
- * Sets new application's shortcut configuration. Windows only.
319
- * @param { ShortCutConfig } config New application's shortcut configuration.
320
- * @param { boolean } [config.desktop] - Enable/disable desktop shortcut.
321
- * @param { boolean } [config.startMenu] - Enable/disable start menu shortcut.
322
- * @param { boolean } [config.systemStartup] - Enable/disable system startup shortcut.
323
- * @return {Promise.<void>}
324
- * @tutorial Application.setShortcuts
325
- */
326
- setShortcuts(config) {
327
- return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
328
- }
329
- /**
330
- * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
331
- * @param { string } queryString The new query string for this app's shortcuts.
332
- * @return {Promise.<void>}
333
- * @tutorial Application.setShortcutQueryParams
334
- */
335
- async setShortcutQueryParams(queryString) {
336
- await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
337
- }
338
- /**
339
- * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
340
- * larger or smaller to default limits of 300% and 50% of original size, respectively.
341
- * @param { number } level The zoom level
342
- * @return {Promise.<void>}
343
- * @tutorial Application.setZoomLevel
344
- */
345
- setZoomLevel(level) {
346
- return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
347
- }
348
- /**
349
- * Sets a username to correlate with App Log Management.
350
- * @param { string } username Username to correlate with App's Log.
351
- * @return {Promise.<void>}
352
- * @tutorial Application.setAppLogUsername
353
- */
354
- async setAppLogUsername(username) {
355
- await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
356
- }
357
- /**
358
- * @summary Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
359
- * @desc The only information currently returned is the position and dimensions.
360
- * @return {Promise.<TrayInfo>}
361
- * @tutorial Application.getTrayIconInfo
362
- */
363
- getTrayIconInfo() {
364
- return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
365
- }
366
- /**
367
- * Closes the application by terminating its process.
368
- * @return {Promise.<void>}
369
- * @tutorial Application.terminate
370
- */
371
- terminate() {
372
- return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
373
- }
374
- /**
375
- * Waits for a hanging application. This method can be called in response to an application
376
- * "not-responding" to allow the application to continue and to generate another "not-responding"
377
- * message after a certain period of time.
378
- * @return {Promise.<void>}
379
- * @ignore
380
- */
381
- wait() {
382
- return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
383
- }
384
- /**
385
- * Retrieves information about the application.
386
- * @return {Promise.<ApplicationInfo>}
387
- * @tutorial Application.getInfo
388
- */
389
- getInfo() {
390
- return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
391
- }
392
- /**
393
- * Retrieves all process information for entities (windows and views) associated with an application.
394
- * @return {Promise.<AppProcessInfo>}
395
- * @tutorial Application.getProcessInfo
396
- * @experimental
397
- */
398
- async getProcessInfo() {
399
- const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
400
- return data;
401
- }
402
- /**
403
- * Sets file auto download location.
404
- * @param { string } downloadLocation file auto download location
405
- * @return {Promise.<void>}
406
- * @tutorial Application.setFileDownloadLocation
407
- */
408
- async setFileDownloadLocation(downloadLocation) {
409
- await this.wire.sendAction('set-file-download-location', { downloadLocation, ...this.identity });
410
- }
411
- }
412
- exports.Application = Application;
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
+ * @classdesc An object representing an application. Allows the developer to create,
10
+ * execute, show/close an application as well as listen to <a href="tutorial-Application.EventEmitter.html">application events</a>.
11
+ * @class
12
+ * @hideconstructor
13
+ */
14
+ class Application extends base_1.EmitterBase {
15
+ constructor(wire, identity) {
16
+ super(wire, 'application', identity.uuid);
17
+ this.identity = identity;
18
+ this.window = new window_1._Window(this.wire, {
19
+ uuid: this.identity.uuid,
20
+ name: this.identity.uuid
21
+ });
22
+ }
23
+ windowListFromIdentityList(identityList) {
24
+ const windowList = [];
25
+ identityList.forEach((identity) => {
26
+ windowList.push(new window_1._Window(this.wire, {
27
+ uuid: identity.uuid,
28
+ name: identity.name
29
+ }));
30
+ });
31
+ return windowList;
32
+ }
33
+ /**
34
+ * Adds a listener to the end of the listeners array for the specified event.
35
+ * @param { string | symbol } eventType - The type of the event.
36
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
37
+ * @param { SubOptions } [options] - Option to support event timestamps.
38
+ * @return {Promise.<this>}
39
+ * @function addListener
40
+ * @memberof Application
41
+ * @instance
42
+ * @tutorial Application.EventEmitter
43
+ */
44
+ /**
45
+ * Adds a listener to the end of the listeners array for the specified event.
46
+ * @param { string | symbol } eventType - The type of the event.
47
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
48
+ * @param { SubOptions } [options] - Option to support event timestamps.
49
+ * @return {Promise.<this>}
50
+ * @function on
51
+ * @memberof Application
52
+ * @instance
53
+ * @tutorial Application.EventEmitter
54
+ */
55
+ /**
56
+ * 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.
57
+ * @param { string | symbol } eventType - The type of the event.
58
+ * @param { Function } listener - The callback function.
59
+ * @param { SubOptions } [options] - Option to support event timestamps.
60
+ * @return {Promise.<this>}
61
+ * @function once
62
+ * @memberof Application
63
+ * @instance
64
+ * @tutorial Application.EventEmitter
65
+ */
66
+ /**
67
+ * Adds a listener to the beginning of the listeners array for the specified event.
68
+ * @param { string | symbol } eventType - The type of the event.
69
+ * @param { Function } listener - The callback function.
70
+ * @param { SubOptions } [options] - Option to support event timestamps.
71
+ * @return {Promise.<this>}
72
+ * @function prependListener
73
+ * @memberof Application
74
+ * @instance
75
+ * @tutorial Application.EventEmitter
76
+ */
77
+ /**
78
+ * 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.
79
+ * The listener is added to the beginning of the listeners array.
80
+ * @param { string | symbol } eventType - The type of the event.
81
+ * @param { Function } listener - The callback function.
82
+ * @param { SubOptions } [options] - Option to support event timestamps.
83
+ * @return {Promise.<this>}
84
+ * @function prependOnceListener
85
+ * @memberof Application
86
+ * @instance
87
+ * @tutorial Application.EventEmitter
88
+ */
89
+ /**
90
+ * Remove a listener from the listener array for the specified event.
91
+ * Caution: Calling this method changes the array indices in the listener array behind the listener.
92
+ * @param { string | symbol } eventType - The type of the event.
93
+ * @param { Function } listener - The callback function.
94
+ * @param { SubOptions } [options] - Option to support event timestamps.
95
+ * @return {Promise.<this>}
96
+ * @function removeListener
97
+ * @memberof Application
98
+ * @instance
99
+ * @tutorial Application.EventEmitter
100
+ */
101
+ /**
102
+ * Removes all listeners, or those of the specified event.
103
+ * @param { string | symbol } [eventType] - The type of the event.
104
+ * @return {Promise.<this>}
105
+ * @function removeAllListeners
106
+ * @memberof Application
107
+ * @instance
108
+ * @tutorial Application.EventEmitter
109
+ */
110
+ /**
111
+ * Determines if the application is currently running.
112
+ * @return {Promise.<boolean>}
113
+ * @tutorial Application.isRunning
114
+ */
115
+ /**
116
+ * JumpListCategory interface
117
+ * @typedef { object } JumpListCategory
118
+ * @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.
119
+ * @property { JumpListItem[] } items Array of JumpListItem objects
120
+ */
121
+ /**
122
+ * JumpListItem interface
123
+ * @typedef { object } JumpListItem
124
+ * @property { string } type One of the following: "task" or "separator". Defaults to task.
125
+ * @property { string } title The text to be displayed for the JumpList Item. Should only be set if type is "task".
126
+ * @property { string } description Description of the task (displayed in a tooltip). Should only be set if type is "task".
127
+ * @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.
128
+ * @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).
129
+ * @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.
130
+ */
131
+ isRunning() {
132
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
133
+ }
134
+ /**
135
+ * Closes the application and any child windows created by the application.
136
+ * Cleans the application from state so it is no longer found in getAllApplications.
137
+ * @param { boolean } [force = false] Close will be prevented from closing when force is false and
138
+ * ‘close-requested’ has been subscribed to for application’s main window.
139
+ * @return {Promise.<boolean>}
140
+ * @tutorial Application.quit
141
+ */
142
+ async quit(force = false) {
143
+ await this._close(force);
144
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
145
+ }
146
+ _close(force = false) {
147
+ return this.wire.sendAction('close-application', { force, ...this.identity }).then(() => undefined);
148
+ }
149
+ close(force = false) {
150
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
151
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
152
+ // we do not want to expose this error, just continue if this analytics-only call fails
153
+ });
154
+ return this._close(force);
155
+ }
156
+ /**
157
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
158
+ * @return {Promise.Array.<_Window>}
159
+ * @tutorial Application.getChildWindows
160
+ */
161
+ getChildWindows() {
162
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
163
+ const identityList = [];
164
+ payload.data.forEach((winName) => {
165
+ identityList.push({ uuid: this.identity.uuid, name: winName });
166
+ });
167
+ return this.windowListFromIdentityList(identityList);
168
+ });
169
+ }
170
+ /**
171
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
172
+ * if the application was not created from a manifest.
173
+ * @return {Promise.<Manifest>}
174
+ * @tutorial Application.getManifest
175
+ */
176
+ getManifest() {
177
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
178
+ }
179
+ /**
180
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
181
+ * if the application was created from a manifest.
182
+ * @return {Promise.<string>}
183
+ * @tutorial Application.getParentUuid
184
+ */
185
+ getParentUuid() {
186
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
187
+ }
188
+ /**
189
+ * Retrieves current application's shortcut configuration.
190
+ * @return {Promise.<ShortCutConfig>}
191
+ * @tutorial Application.getShortcuts
192
+ */
193
+ getShortcuts() {
194
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
195
+ }
196
+ /**
197
+ * Retrieves current application's views.
198
+ * @experimental
199
+ * @return {Promise.Array.<View>}
200
+ * @tutorial Application.getViews
201
+ */
202
+ async getViews() {
203
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
204
+ return payload.data.map((id) => new view_1.View(this.wire, id));
205
+ }
206
+ /**
207
+ * Returns the current zoom level of the application.
208
+ * @return {Promise.<number>}
209
+ * @tutorial Application.getZoomLevel
210
+ */
211
+ getZoomLevel() {
212
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
213
+ }
214
+ /**
215
+ * Returns an instance of the main Window of the application
216
+ * @return {Promise.<_Window>}
217
+ * @tutorial Application.getWindow
218
+ */
219
+ getWindow() {
220
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
221
+ // we do not want to expose this error, just continue if this analytics-only call fails
222
+ });
223
+ return Promise.resolve(this.window);
224
+ }
225
+ /**
226
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
227
+ * @param { string } userName - username to be passed to the RVM.
228
+ * @param { string } appName - app name to be passed to the RVM.
229
+ * @return {Promise.<void>}
230
+ * @tutorial Application.registerUser
231
+ */
232
+ registerUser(userName, appName) {
233
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
234
+ }
235
+ /**
236
+ * Removes the application’s icon from the tray.
237
+ * @return {Promise.<void>}
238
+ * @tutorial Application.removeTrayIcon
239
+ */
240
+ removeTrayIcon() {
241
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
242
+ }
243
+ /**
244
+ * Restarts the application.
245
+ * @return {Promise.<void>}
246
+ * @tutorial Application.restart
247
+ */
248
+ restart() {
249
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
250
+ }
251
+ /**
252
+ * DEPRECATED method to run the application.
253
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
254
+ * @return {Promise.<void>}
255
+ * @tutorial Application.run
256
+ * @ignore
257
+ */
258
+ run() {
259
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
260
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
261
+ // we do not want to expose this error, just continue if this analytics-only call fails
262
+ });
263
+ return this._run();
264
+ }
265
+ _run(opts = {}) {
266
+ return this.wire
267
+ .sendAction('run-application', {
268
+ manifestUrl: this._manifestUrl,
269
+ opts,
270
+ ...this.identity
271
+ })
272
+ .then(() => undefined);
273
+ }
274
+ /**
275
+ * Instructs the RVM to schedule one restart of the application.
276
+ * @return {Promise.<void>}
277
+ * @tutorial Application.scheduleRestart
278
+ */
279
+ scheduleRestart() {
280
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
281
+ }
282
+ /**
283
+ * Sends a message to the RVM to upload the application's logs. On success,
284
+ * an object containing logId is returned.
285
+ * @return {Promise.<SendApplicationLogResponse>}
286
+ * @tutorial Application.sendApplicationLog
287
+ */
288
+ async sendApplicationLog() {
289
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
290
+ return payload.data;
291
+ }
292
+ /**
293
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
294
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
295
+ * Note: If the "name" property is omitted it defaults to "tasks".
296
+ * @param { Array.<JumpListCategory> | null } jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
297
+ * @return { Promise.<void> }
298
+ * @tutorial Application.setJumpList
299
+ */
300
+ async setJumpList(jumpListCategories) {
301
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
302
+ }
303
+ /**
304
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
305
+ * @param { string } icon Image URL or base64 encoded string to be used as the icon
306
+ * @return {Promise.<void>}
307
+ * @tutorial Application.setTrayIcon
308
+ */
309
+ setTrayIcon(icon) {
310
+ return this.wire
311
+ .sendAction('set-tray-icon', {
312
+ enabledIcon: icon,
313
+ ...this.identity
314
+ })
315
+ .then(() => undefined);
316
+ }
317
+ /**
318
+ * Sets new application's shortcut configuration. Windows only.
319
+ * @param { ShortCutConfig } config New application's shortcut configuration.
320
+ * @param { boolean } [config.desktop] - Enable/disable desktop shortcut.
321
+ * @param { boolean } [config.startMenu] - Enable/disable start menu shortcut.
322
+ * @param { boolean } [config.systemStartup] - Enable/disable system startup shortcut.
323
+ * @return {Promise.<void>}
324
+ * @tutorial Application.setShortcuts
325
+ */
326
+ setShortcuts(config) {
327
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
328
+ }
329
+ /**
330
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
331
+ * @param { string } queryString The new query string for this app's shortcuts.
332
+ * @return {Promise.<void>}
333
+ * @tutorial Application.setShortcutQueryParams
334
+ */
335
+ async setShortcutQueryParams(queryString) {
336
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
337
+ }
338
+ /**
339
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
340
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
341
+ * @param { number } level The zoom level
342
+ * @return {Promise.<void>}
343
+ * @tutorial Application.setZoomLevel
344
+ */
345
+ setZoomLevel(level) {
346
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
347
+ }
348
+ /**
349
+ * Sets a username to correlate with App Log Management.
350
+ * @param { string } username Username to correlate with App's Log.
351
+ * @return {Promise.<void>}
352
+ * @tutorial Application.setAppLogUsername
353
+ */
354
+ async setAppLogUsername(username) {
355
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
356
+ }
357
+ /**
358
+ * @summary Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
359
+ * @desc The only information currently returned is the position and dimensions.
360
+ * @return {Promise.<TrayInfo>}
361
+ * @tutorial Application.getTrayIconInfo
362
+ */
363
+ getTrayIconInfo() {
364
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
365
+ }
366
+ /**
367
+ * Closes the application by terminating its process.
368
+ * @return {Promise.<void>}
369
+ * @tutorial Application.terminate
370
+ */
371
+ terminate() {
372
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
373
+ }
374
+ /**
375
+ * Waits for a hanging application. This method can be called in response to an application
376
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
377
+ * message after a certain period of time.
378
+ * @return {Promise.<void>}
379
+ * @ignore
380
+ */
381
+ wait() {
382
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
383
+ }
384
+ /**
385
+ * Retrieves information about the application.
386
+ * @return {Promise.<ApplicationInfo>}
387
+ * @tutorial Application.getInfo
388
+ */
389
+ getInfo() {
390
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
391
+ }
392
+ /**
393
+ * Retrieves all process information for entities (windows and views) associated with an application.
394
+ * @return {Promise.<AppProcessInfo>}
395
+ * @tutorial Application.getProcessInfo
396
+ * @experimental
397
+ */
398
+ async getProcessInfo() {
399
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
400
+ return data;
401
+ }
402
+ /**
403
+ * Sets file auto download location.
404
+ * @param { string } downloadLocation file auto download location
405
+ * @return {Promise.<void>}
406
+ * @tutorial Application.setFileDownloadLocation
407
+ */
408
+ async setFileDownloadLocation(downloadLocation) {
409
+ await this.wire.sendAction('set-file-download-location', { downloadLocation, ...this.identity });
410
+ }
411
+ }
412
+ exports.Application = Application;