@openfin/core 33.76.31 → 33.76.36

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 (116) hide show
  1. package/openfin-core-33.76.36.tgz +0 -0
  2. package/package.json +1 -1
  3. package/src/OpenFin.d.ts +27 -16
  4. package/src/api/application/Factory.d.ts +148 -100
  5. package/src/api/application/Factory.js +148 -100
  6. package/src/api/application/Instance.d.ts +477 -106
  7. package/src/api/application/Instance.js +474 -106
  8. package/src/api/application/index.d.ts +9 -0
  9. package/src/api/application/index.js +9 -0
  10. package/src/api/base.d.ts +69 -0
  11. package/src/api/base.js +69 -0
  12. package/src/api/clipboard/index.d.ts +111 -31
  13. package/src/api/clipboard/index.js +111 -31
  14. package/src/api/events/application.d.ts +12 -0
  15. package/src/api/events/application.js +12 -0
  16. package/src/api/events/channel.d.ts +5 -0
  17. package/src/api/events/channel.js +5 -0
  18. package/src/api/events/externalApplication.d.ts +5 -0
  19. package/src/api/events/externalApplication.js +5 -0
  20. package/src/api/events/frame.d.ts +5 -0
  21. package/src/api/events/globalHotkey.d.ts +5 -0
  22. package/src/api/events/platform.d.ts +9 -1
  23. package/src/api/events/platform.js +8 -0
  24. package/src/api/events/system.d.ts +13 -0
  25. package/src/api/events/system.js +13 -0
  26. package/src/api/events/view.d.ts +19 -9
  27. package/src/api/events/view.js +10 -0
  28. package/src/api/events/webcontents.d.ts +21 -10
  29. package/src/api/events/webcontents.js +11 -0
  30. package/src/api/events/window.d.ts +70 -1
  31. package/src/api/events/window.js +10 -0
  32. package/src/api/external-application/Factory.d.ts +16 -9
  33. package/src/api/external-application/Factory.js +16 -9
  34. package/src/api/external-application/Instance.d.ts +40 -32
  35. package/src/api/external-application/Instance.js +40 -32
  36. package/src/api/external-application/index.d.ts +9 -0
  37. package/src/api/external-application/index.js +9 -0
  38. package/src/api/fin.d.ts +3 -0
  39. package/src/api/fin.js +3 -0
  40. package/src/api/frame/Factory.d.ts +30 -13
  41. package/src/api/frame/Factory.js +30 -13
  42. package/src/api/frame/Instance.d.ts +51 -38
  43. package/src/api/frame/Instance.js +51 -38
  44. package/src/api/frame/index.d.ts +11 -0
  45. package/src/api/frame/index.js +11 -0
  46. package/src/api/global-hotkey/index.d.ts +81 -13
  47. package/src/api/global-hotkey/index.js +81 -13
  48. package/src/api/interappbus/channel/channel.d.ts +257 -0
  49. package/src/api/interappbus/channel/channel.js +257 -0
  50. package/src/api/interappbus/channel/channels-docs.d.ts +59 -57
  51. package/src/api/interappbus/channel/channels-docs.js +71 -68
  52. package/src/api/interappbus/channel/client.d.ts +93 -0
  53. package/src/api/interappbus/channel/client.js +93 -1
  54. package/src/api/interappbus/channel/index.d.ts +164 -0
  55. package/src/api/interappbus/channel/index.js +165 -1
  56. package/src/api/interappbus/channel/provider.d.ts +172 -0
  57. package/src/api/interappbus/channel/provider.js +172 -0
  58. package/src/api/interappbus/index.d.ts +55 -20
  59. package/src/api/interappbus/index.js +55 -20
  60. package/src/api/interop/Factory.d.ts +30 -10
  61. package/src/api/interop/Factory.js +30 -10
  62. package/src/api/interop/InteropBroker.d.ts +298 -70
  63. package/src/api/interop/InteropBroker.js +298 -70
  64. package/src/api/interop/InteropClient.d.ts +286 -62
  65. package/src/api/interop/InteropClient.js +286 -62
  66. package/src/api/interop/SessionContextGroupClient.d.ts +2 -2
  67. package/src/api/interop/SessionContextGroupClient.js +2 -2
  68. package/src/api/interop/fdc3/documentationStub.d.ts +14 -0
  69. package/src/api/interop/fdc3/documentationStub.js +17 -0
  70. package/src/api/interop/fdc3/fdc3-1.2.d.ts +31 -34
  71. package/src/api/interop/fdc3/fdc3-1.2.js +31 -34
  72. package/src/api/interop/fdc3/fdc3-2.0.d.ts +48 -51
  73. package/src/api/interop/fdc3/fdc3-2.0.js +48 -51
  74. package/src/api/interop/index.d.ts +8 -0
  75. package/src/api/interop/index.js +8 -0
  76. package/src/api/platform/Factory.d.ts +121 -65
  77. package/src/api/platform/Factory.js +122 -66
  78. package/src/api/platform/Instance.d.ts +551 -48
  79. package/src/api/platform/Instance.js +551 -49
  80. package/src/api/platform/index.d.ts +9 -0
  81. package/src/api/platform/index.js +9 -0
  82. package/src/api/platform/layout/Factory.d.ts +53 -76
  83. package/src/api/platform/layout/Factory.js +53 -76
  84. package/src/api/platform/layout/Instance.d.ts +158 -23
  85. package/src/api/platform/layout/Instance.js +118 -20
  86. package/src/api/platform/layout/entities/layout-entities.d.ts +222 -30
  87. package/src/api/platform/layout/entities/layout-entities.js +222 -30
  88. package/src/api/platform/layout/index.d.ts +9 -0
  89. package/src/api/platform/layout/index.js +9 -0
  90. package/src/api/platform/provider.d.ts +398 -51
  91. package/src/api/snapshot-source/Factory.d.ts +33 -18
  92. package/src/api/snapshot-source/Factory.js +33 -18
  93. package/src/api/snapshot-source/Instance.d.ts +30 -8
  94. package/src/api/snapshot-source/Instance.js +30 -8
  95. package/src/api/snapshot-source/index.d.ts +9 -0
  96. package/src/api/snapshot-source/index.js +9 -0
  97. package/src/api/system/index.d.ts +1137 -186
  98. package/src/api/system/index.js +1142 -186
  99. package/src/api/view/Factory.d.ts +54 -16
  100. package/src/api/view/Factory.js +54 -16
  101. package/src/api/view/Instance.d.ts +330 -216
  102. package/src/api/view/Instance.js +331 -217
  103. package/src/api/view/index.d.ts +9 -0
  104. package/src/api/view/index.js +9 -0
  105. package/src/api/webcontents/main.d.ts +890 -0
  106. package/src/api/webcontents/main.js +890 -0
  107. package/src/api/window/Factory.d.ts +67 -16
  108. package/src/api/window/Factory.js +67 -16
  109. package/src/api/window/Instance.d.ts +824 -316
  110. package/src/api/window/Instance.js +822 -320
  111. package/src/api/window/index.d.ts +11 -0
  112. package/src/api/window/index.js +11 -0
  113. package/src/namespaces.d.ts +1 -0
  114. package/src/namespaces.js +3 -1
  115. package/src/shapes/protocol.d.ts +4 -0
  116. package/openfin-core-33.76.31.tgz +0 -0
@@ -2,23 +2,27 @@ import type * as OpenFin from '../../OpenFin';
2
2
  import { EmitterBase } from '../base';
3
3
  import { Transport } from '../../transport/transport';
4
4
  /**
5
- * @classdesc An object representing an application. Allows the developer to create,
6
- * execute, show/close an application as well as listen to <a href="tutorial-Application.EventEmitter.html">application events</a>.
7
- * @class
8
- * @hideconstructor
5
+ * An object representing an application. Allows the developer to create,
6
+ * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
9
7
  */
10
8
  export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
11
9
  identity: OpenFin.ApplicationIdentity;
10
+ /**
11
+ * @internal
12
+ */
12
13
  _manifestUrl?: string;
13
14
  private window;
15
+ /**
16
+ * @internal
17
+ */
14
18
  constructor(wire: Transport, identity: OpenFin.ApplicationIdentity);
15
19
  private windowListFromIdentityList;
16
20
  /**
17
21
  * Adds a listener to the end of the listeners array for the specified event.
18
- * @param { string | symbol } eventType - The type of the event.
19
- * @param { Function } listener - Called whenever an event of the specified type occurs.
20
- * @param { SubOptions } [options] - Option to support event timestamps.
21
- * @return {Promise.<this>}
22
+ * @param eventType - The type of the event.
23
+ * @param listener - Called whenever an event of the specified type occurs.
24
+ * @param options - Option to support event timestamps.
25
+ *
22
26
  * @function addListener
23
27
  * @memberof Application
24
28
  * @instance
@@ -26,10 +30,10 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
26
30
  */
27
31
  /**
28
32
  * Adds a listener to the end of the listeners array for the specified event.
29
- * @param { string | symbol } eventType - The type of the event.
30
- * @param { Function } listener - Called whenever an event of the specified type occurs.
31
- * @param { SubOptions } [options] - Option to support event timestamps.
32
- * @return {Promise.<this>}
33
+ * @param eventType - The type of the event.
34
+ * @param listener - Called whenever an event of the specified type occurs.
35
+ * @param options - Option to support event timestamps.
36
+ *
33
37
  * @function on
34
38
  * @memberof Application
35
39
  * @instance
@@ -37,10 +41,10 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
37
41
  */
38
42
  /**
39
43
  * 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.
40
- * @param { string | symbol } eventType - The type of the event.
41
- * @param { Function } listener - The callback function.
42
- * @param { SubOptions } [options] - Option to support event timestamps.
43
- * @return {Promise.<this>}
44
+ * @param eventType - The type of the event.
45
+ * @param listener - The callback function.
46
+ * @param options - Option to support event timestamps.
47
+ *
44
48
  * @function once
45
49
  * @memberof Application
46
50
  * @instance
@@ -48,10 +52,10 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
48
52
  */
49
53
  /**
50
54
  * Adds a listener to the beginning of the listeners array for the specified event.
51
- * @param { string | symbol } eventType - The type of the event.
52
- * @param { Function } listener - The callback function.
53
- * @param { SubOptions } [options] - Option to support event timestamps.
54
- * @return {Promise.<this>}
55
+ * @param eventType - The type of the event.
56
+ * @param listener - The callback function.
57
+ * @param options - Option to support event timestamps.
58
+ *
55
59
  * @function prependListener
56
60
  * @memberof Application
57
61
  * @instance
@@ -60,10 +64,10 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
60
64
  /**
61
65
  * 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.
62
66
  * The listener is added to the beginning of the listeners array.
63
- * @param { string | symbol } eventType - The type of the event.
64
- * @param { Function } listener - The callback function.
65
- * @param { SubOptions } [options] - Option to support event timestamps.
66
- * @return {Promise.<this>}
67
+ * @param eventType - The type of the event.
68
+ * @param listener - The callback function.
69
+ * @param options - Option to support event timestamps.
70
+ *
67
71
  * @function prependOnceListener
68
72
  * @memberof Application
69
73
  * @instance
@@ -72,10 +76,10 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
72
76
  /**
73
77
  * Remove a listener from the listener array for the specified event.
74
78
  * Caution: Calling this method changes the array indices in the listener array behind the listener.
75
- * @param { string | symbol } eventType - The type of the event.
76
- * @param { Function } listener - The callback function.
77
- * @param { SubOptions } [options] - Option to support event timestamps.
78
- * @return {Promise.<this>}
79
+ * @param eventType - The type of the event.
80
+ * @param listener - The callback function.
81
+ * @param options - Option to support event timestamps.
82
+ *
79
83
  * @function removeListener
80
84
  * @memberof Application
81
85
  * @instance
@@ -83,18 +87,13 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
83
87
  */
84
88
  /**
85
89
  * Removes all listeners, or those of the specified event.
86
- * @param { string | symbol } [eventType] - The type of the event.
87
- * @return {Promise.<this>}
90
+ * @param eventType - The type of the event.
91
+ *
88
92
  * @function removeAllListeners
89
93
  * @memberof Application
90
94
  * @instance
91
95
  * @tutorial Application.EventEmitter
92
96
  */
93
- /**
94
- * Determines if the application is currently running.
95
- * @return {Promise.<boolean>}
96
- * @tutorial Application.isRunning
97
- */
98
97
  /**
99
98
  * JumpListCategory interface
100
99
  * @typedef { object } JumpListCategory
@@ -112,190 +111,546 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
112
111
  * @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).
113
112
  * @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.
114
113
  */
114
+ /**
115
+ * Determines if the application is currently running.
116
+ *
117
+ * @example
118
+ *
119
+ * ```js
120
+ * async function isAppRunning() {
121
+ * const app = await fin.Application.getCurrent();
122
+ * return await app.isRunning();
123
+ * }
124
+ * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
125
+ * ```
126
+ */
115
127
  isRunning(): Promise<boolean>;
116
128
  /**
117
129
  * Closes the application and any child windows created by the application.
118
130
  * Cleans the application from state so it is no longer found in getAllApplications.
119
- * @param { boolean } [force = false] Close will be prevented from closing when force is false and
131
+ * @param force Close will be prevented from closing when force is false and
120
132
  * ‘close-requested’ has been subscribed to for application’s main window.
121
- * @return {Promise.<boolean>}
122
- * @tutorial Application.quit
133
+ *
134
+ * @example
135
+ *
136
+ * ```js
137
+ * async function closeApp() {
138
+ * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
139
+ * const app = await fin.Application.wrap({uuid: 'app2'});
140
+ * await app.quit();
141
+ * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
142
+ *
143
+ * }
144
+ * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
145
+ * ```
123
146
  */
124
147
  quit(force?: boolean): Promise<void>;
125
148
  private _close;
149
+ /**
150
+ * @deprecated use Application.quit instead
151
+ * Closes the application and any child windows created by the application.
152
+ * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
153
+ * @param callback - called if the method succeeds.
154
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
155
+ *
156
+ * @example
157
+ *
158
+ * ```js
159
+ * async function closeApp() {
160
+ * const app = await fin.Application.getCurrent();
161
+ * return await app.close();
162
+ * }
163
+ * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
164
+ * ```
165
+ */
126
166
  close(force?: boolean): Promise<void>;
127
167
  /**
128
168
  * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
129
- * @return {Promise.Array.<_Window>}
130
- * @tutorial Application.getChildWindows
169
+ *
170
+ * @example
171
+ *
172
+ * ```js
173
+ * async function getChildWindows() {
174
+ * const app = await fin.Application.getCurrent();
175
+ * return await app.getChildWindows();
176
+ * }
177
+ *
178
+ * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
179
+ * ```
131
180
  */
132
181
  getChildWindows(): Promise<Array<OpenFin.Window>>;
133
182
  /**
134
183
  * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
135
184
  * if the application was not created from a manifest.
136
- * @return {Promise.<Manifest>}
137
- * @tutorial Application.getManifest
185
+ *
186
+ * @example
187
+ *
188
+ * ```js
189
+ * async function getManifest() {
190
+ * const app = await fin.Application.getCurrent();
191
+ * return await app.getManifest();
192
+ * }
193
+ *
194
+ * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
195
+ * ```
138
196
  */
139
197
  getManifest(): Promise<OpenFin.Manifest>;
140
198
  /**
141
199
  * Retrieves UUID of the application that launches this application. Invokes the error callback
142
200
  * if the application was created from a manifest.
143
- * @return {Promise.<string>}
144
- * @tutorial Application.getParentUuid
201
+ *
202
+ * @example
203
+ *
204
+ * ```js
205
+ * async function getParentUuid() {
206
+ * const app = await fin.Application.start({
207
+ * uuid: 'app-1',
208
+ * name: 'myApp',
209
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
210
+ * autoShow: true
211
+ * });
212
+ * return await app.getParentUuid();
213
+ * }
214
+ *
215
+ * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
216
+ * ```
145
217
  */
146
218
  getParentUuid(): Promise<string>;
147
219
  /**
148
220
  * Retrieves current application's shortcut configuration.
149
- * @return {Promise.<ShortCutConfig>}
150
- * @tutorial Application.getShortcuts
221
+ *
222
+ * @example
223
+ *
224
+ * ```js
225
+ * async function getShortcuts() {
226
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
227
+ * return await app.getShortcuts();
228
+ * }
229
+ * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
230
+ * ```
151
231
  */
152
232
  getShortcuts(): Promise<OpenFin.ShortCutConfig>;
153
233
  /**
154
234
  * Retrieves current application's views.
155
235
  * @experimental
156
- * @return {Promise.Array.<View>}
157
- * @tutorial Application.getViews
236
+ *
237
+ * @example
238
+ *
239
+ * ```js
240
+ * async function getViews() {
241
+ * const app = await fin.Application.getCurrent();
242
+ * return await app.getViews();
243
+ * }
244
+ * getViews().then(views => console.log(views)).catch(err => console.log(err));
245
+ * ```
158
246
  */
159
247
  getViews(): Promise<Array<OpenFin.View>>;
160
248
  /**
161
249
  * Returns the current zoom level of the application.
162
- * @return {Promise.<number>}
163
- * @tutorial Application.getZoomLevel
250
+ *
251
+ * @example
252
+ *
253
+ * ```js
254
+ * async function getZoomLevel() {
255
+ * const app = await fin.Application.getCurrent();
256
+ * return await app.getZoomLevel();
257
+ * }
258
+ *
259
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
260
+ * ```
164
261
  */
165
262
  getZoomLevel(): Promise<number>;
166
263
  /**
167
264
  * Returns an instance of the main Window of the application
168
- * @return {Promise.<_Window>}
169
- * @tutorial Application.getWindow
265
+ *
266
+ * @example
267
+ *
268
+ * ```js
269
+ * async function getWindow() {
270
+ * const app = await fin.Application.start({
271
+ * uuid: 'app-1',
272
+ * name: 'myApp',
273
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
274
+ * autoShow: true
275
+ * });
276
+ * return await app.getWindow();
277
+ * }
278
+ *
279
+ * getWindow().then(win => {
280
+ * win.showAt(0, 400);
281
+ * win.flash();
282
+ * }).catch(err => console.log(err));
283
+ * ```
170
284
  */
171
285
  getWindow(): Promise<OpenFin.Window>;
172
286
  /**
173
287
  * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
174
- * @param { string } userName - username to be passed to the RVM.
175
- * @param { string } appName - app name to be passed to the RVM.
176
- * @return {Promise.<void>}
177
- * @tutorial Application.registerUser
288
+ * @param userName - username to be passed to the RVM.
289
+ * @param appName - app name to be passed to the RVM.
290
+ *
291
+ * @example
292
+ *
293
+ * ```js
294
+ * async function registerUser() {
295
+ * const app = await fin.Application.getCurrent();
296
+ * return await app.registerUser('user', 'myApp');
297
+ * }
298
+ *
299
+ * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
300
+ * ```
178
301
  */
179
302
  registerUser(userName: string, appName: string): Promise<void>;
180
303
  /**
181
304
  * Removes the application’s icon from the tray.
182
- * @return {Promise.<void>}
183
- * @tutorial Application.removeTrayIcon
305
+ *
306
+ * @example
307
+ *
308
+ * ```js
309
+ * async function removeTrayIcon() {
310
+ * const app = await fin.Application.getCurrent();
311
+ * return await app.removeTrayIcon();
312
+ * }
313
+ *
314
+ * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
315
+ * ```
184
316
  */
185
317
  removeTrayIcon(): Promise<void>;
186
318
  /**
187
319
  * Restarts the application.
188
- * @return {Promise.<void>}
189
- * @tutorial Application.restart
320
+ *
321
+ * @example
322
+ *
323
+ * ```js
324
+ * async function restartApp() {
325
+ * const app = await fin.Application.getCurrent();
326
+ * return await app.restart();
327
+ * }
328
+ * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
329
+ * ```
190
330
  */
191
331
  restart(): Promise<void>;
192
332
  /**
193
333
  * DEPRECATED method to run the application.
194
334
  * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
195
- * @return {Promise.<void>}
196
- * @tutorial Application.run
335
+ *
336
+ * @example
337
+ *
338
+ * ```js
339
+ * async function run() {
340
+ * const app = await fin.Application.create({
341
+ * name: 'myApp',
342
+ * uuid: 'app-1',
343
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
344
+ * autoShow: true
345
+ * });
346
+ * await app.run();
347
+ * }
348
+ * run().then(() => console.log('Application is running')).catch(err => console.log(err));
349
+ * ```
350
+ *
197
351
  * @ignore
198
352
  */
199
353
  run(): Promise<void>;
200
354
  private _run;
201
355
  /**
202
356
  * Instructs the RVM to schedule one restart of the application.
203
- * @return {Promise.<void>}
204
- * @tutorial Application.scheduleRestart
357
+ *
358
+ * @example
359
+ *
360
+ * ```js
361
+ * async function scheduleRestart() {
362
+ * const app = await fin.Application.getCurrent();
363
+ * return await app.scheduleRestart();
364
+ * }
365
+ *
366
+ * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
367
+ * ```
205
368
  */
206
369
  scheduleRestart(): Promise<void>;
207
370
  /**
208
371
  * Sends a message to the RVM to upload the application's logs. On success,
209
372
  * an object containing logId is returned.
210
- * @return {Promise.<SendApplicationLogResponse>}
211
- * @tutorial Application.sendApplicationLog
373
+ *
374
+ * @example
375
+ *
376
+ * ```js
377
+ * async function sendLog() {
378
+ * const app = await fin.Application.getCurrent();
379
+ * return await app.sendApplicationLog();
380
+ * }
381
+ *
382
+ * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
383
+ * ```
212
384
  */
213
385
  sendApplicationLog(): Promise<OpenFin.SendApplicationLogResponse>;
214
386
  /**
215
387
  * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
216
388
  * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
217
389
  * Note: If the "name" property is omitted it defaults to "tasks".
218
- * @param { Array.<JumpListCategory> | null } jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
219
- * @return { Promise.<void> }
220
- * @tutorial Application.setJumpList
390
+ * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
391
+ *
392
+ *
393
+ * @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).
394
+ *
395
+ * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
396
+ * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
397
+ *
398
+ * Note: If the "name" property is omitted it defaults to "tasks".
399
+ *
400
+ * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
401
+ * uuid or shortcut.name is changed.
402
+ *
403
+ * @example
404
+ *
405
+ * ```js
406
+ * const app = fin.Application.getCurrentSync();
407
+ * const appName = 'My App';
408
+ * const jumpListConfig = [ // array of JumpList categories
409
+ * {
410
+ * // has no name and no type so `type` is assumed to be "tasks"
411
+ * items: [ // array of JumpList items
412
+ * {
413
+ * type: 'task',
414
+ * title: `Launch ${appName}`,
415
+ * description: `Runs ${appName} with the default configuration`,
416
+ * deepLink: 'fins://path.to/app/manifest.json',
417
+ * iconPath: 'https://path.to/app/icon.ico',
418
+ * iconIndex: 0
419
+ * },
420
+ * { type: 'separator' },
421
+ * {
422
+ * type: 'task',
423
+ * title: `Restore ${appName}`,
424
+ * description: 'Restore to last configuration',
425
+ * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
426
+ * iconPath: 'https://path.to/app/icon.ico',
427
+ * iconIndex: 0
428
+ * },
429
+ * ]
430
+ * },
431
+ * {
432
+ * name: 'Tools',
433
+ * items: [ // array of JumpList items
434
+ * {
435
+ * type: 'task',
436
+ * title: 'Tool A',
437
+ * description: 'Runs Tool A',
438
+ * deepLink: 'fins://path.to/tool-a/manifest.json',
439
+ * iconPath: 'https://path.to/tool-a/icon.ico',
440
+ * iconIndex: 0
441
+ * },
442
+ * {
443
+ * type: 'task',
444
+ * title: 'Tool B',
445
+ * description: 'Runs Tool B',
446
+ * deepLink: 'fins://path.to/tool-b/manifest.json',
447
+ * iconPath: 'https://path.to/tool-b/icon.ico',
448
+ * iconIndex: 0
449
+ * }]
450
+ * }
451
+ * ];
452
+ *
453
+ * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
454
+ * ```
455
+ *
456
+ * To handle deeplink args:
457
+ * ```js
458
+ * function handleUseLastConfiguration() {
459
+ * // this handler is called when the app is being launched
460
+ * app.on('run-requested', event => {
461
+ * if(event.userAppConfigArgs['use-last-configuration']) {
462
+ * // your logic here
463
+ * }
464
+ * });
465
+ * // this handler is called when the app was already running when the launch was requested
466
+ * fin.desktop.main(function(args) {
467
+ * if(args && args['use-last-configuration']) {
468
+ * // your logic here
469
+ * }
470
+ * });
471
+ * }
472
+ * ```
221
473
  */
222
474
  setJumpList(jumpListCategories: OpenFin.JumpListCategory[] | null): Promise<void>;
223
475
  /**
224
476
  * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
225
- * @param { string } icon Image URL or base64 encoded string to be used as the icon
226
- * @return {Promise.<void>}
227
- * @tutorial Application.setTrayIcon
477
+ * @param icon Image URL or base64 encoded string to be used as the icon
478
+ *
479
+ * @example
480
+ *
481
+ * ```js
482
+ * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
483
+ * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
484
+ * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
485
+ * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
486
+ * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
487
+ *
488
+ * async function setTrayIcon(icon) {
489
+ * const app = await fin.Application.getCurrent();
490
+ * return await app.setTrayIcon(icon);
491
+ * }
492
+ *
493
+ * // use image url to set tray icon
494
+ * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
495
+ *
496
+ * // use base64 encoded string to set tray icon
497
+ * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
498
+ *
499
+ * // use a dataURL to set tray icon
500
+ * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
501
+ * ```
228
502
  */
229
503
  setTrayIcon(icon: string): Promise<void>;
230
504
  /**
231
505
  * Sets new application's shortcut configuration. Windows only.
232
- * @param { ShortCutConfig } config New application's shortcut configuration.
233
- * @param { boolean } [config.desktop] - Enable/disable desktop shortcut.
234
- * @param { boolean } [config.startMenu] - Enable/disable start menu shortcut.
235
- * @param { boolean } [config.systemStartup] - Enable/disable system startup shortcut.
236
- * @return {Promise.<void>}
237
- * @tutorial Application.setShortcuts
506
+ * @param config New application's shortcut configuration.
507
+ *
508
+ * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
509
+ * to be able to change shortcut states.
510
+ *
511
+ * @example
512
+ *
513
+ * ```js
514
+ * async function setShortcuts(config) {
515
+ * const app = await fin.Application.getCurrent();
516
+ * return app.setShortcuts(config);
517
+ * }
518
+ *
519
+ * setShortcuts({
520
+ * desktop: true,
521
+ * startMenu: false,
522
+ * systemStartup: true
523
+ * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
524
+ * ```
238
525
  */
239
526
  setShortcuts(config: OpenFin.ShortCutConfig): Promise<void>;
240
527
  /**
241
528
  * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
242
- * @param { string } queryString The new query string for this app's shortcuts.
243
- * @return {Promise.<void>}
244
- * @tutorial Application.setShortcutQueryParams
529
+ * @param queryString The new query string for this app's shortcuts.
530
+ *
531
+ * @example
532
+ *
533
+ * ```js
534
+ * const newQueryArgs = 'arg=true&arg2=false';
535
+ * const app = await fin.Application.getCurrent();
536
+ * try {
537
+ * await app.setShortcutQueryParams(newQueryArgs);
538
+ * } catch(err) {
539
+ * console.error(err)
540
+ * }
541
+ * ```
245
542
  */
246
543
  setShortcutQueryParams(queryString: string): Promise<void>;
247
544
  /**
248
545
  * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
249
546
  * larger or smaller to default limits of 300% and 50% of original size, respectively.
250
- * @param { number } level The zoom level
251
- * @return {Promise.<void>}
252
- * @tutorial Application.setZoomLevel
547
+ * @param level The zoom level
548
+ *
549
+ * @example
550
+ *
551
+ * ```js
552
+ * async function setZoomLevel(number) {
553
+ * const app = await fin.Application.getCurrent();
554
+ * return await app.setZoomLevel(number);
555
+ * }
556
+ *
557
+ * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
558
+ * ```
253
559
  */
254
560
  setZoomLevel(level: number): Promise<void>;
255
561
  /**
256
562
  * Sets a username to correlate with App Log Management.
257
- * @param { string } username Username to correlate with App's Log.
258
- * @return {Promise.<void>}
259
- * @tutorial Application.setAppLogUsername
563
+ * @param username Username to correlate with App's Log.
564
+ *
565
+ * @example
566
+ *
567
+ * ```js
568
+ * async function setAppLogUser() {
569
+ * const app = await fin.Application.getCurrent();
570
+ * return await app.setAppLogUsername('username');
571
+ * }
572
+ *
573
+ * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
574
+ *
575
+ * ```
260
576
  */
261
577
  setAppLogUsername(username: string): Promise<void>;
262
578
  /**
263
- * @summary Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
264
- * @desc The only information currently returned is the position and dimensions.
265
- * @return {Promise.<TrayInfo>}
266
- * @tutorial Application.getTrayIconInfo
579
+ * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
580
+ * @remarks The only information currently returned is the position and dimensions.
581
+ *
582
+ * @example
583
+ *
584
+ * ```js
585
+ * async function getTrayIconInfo() {
586
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
587
+ * return await app.getTrayIconInfo();
588
+ * }
589
+ * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
590
+ * ```
267
591
  */
268
592
  getTrayIconInfo(): Promise<OpenFin.TrayInfo>;
269
593
  /**
270
- * @summary Checks if the application has an associated tray icon.
271
- * @return {Promise.<boolean>}
272
- * @tutorial Application.hasTrayIcon
594
+ * Checks if the application has an associated tray icon.
595
+ *
596
+ * @example
597
+ *
598
+ * ```js
599
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
600
+ * const hasTrayIcon = await app.hasTrayIcon();
601
+ * console.log(hasTrayIcon);
602
+ * ```
273
603
  */
274
604
  hasTrayIcon(): Promise<boolean>;
275
605
  /**
276
606
  * Closes the application by terminating its process.
277
- * @return {Promise.<void>}
278
- * @tutorial Application.terminate
607
+ *
608
+ * @example
609
+ *
610
+ * ```js
611
+ * async function terminateApp() {
612
+ * const app = await fin.Application.getCurrent();
613
+ * return await app.terminate();
614
+ * }
615
+ * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
616
+ * ```
279
617
  */
280
618
  terminate(): Promise<void>;
281
619
  /**
282
620
  * Waits for a hanging application. This method can be called in response to an application
283
621
  * "not-responding" to allow the application to continue and to generate another "not-responding"
284
622
  * message after a certain period of time.
285
- * @return {Promise.<void>}
623
+ *
286
624
  * @ignore
287
625
  */
288
626
  wait(): Promise<void>;
289
627
  /**
290
628
  * Retrieves information about the application.
291
- * @return {Promise.<ApplicationInfo>}
292
- * @tutorial Application.getInfo
629
+ *
630
+ * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
631
+ * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
632
+ * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
633
+ *
634
+ * @example
635
+ *
636
+ * ```js
637
+ * async function getInfo() {
638
+ * const app = await fin.Application.getCurrent();
639
+ * return await app.getInfo();
640
+ * }
641
+ *
642
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
643
+ * ```
293
644
  */
294
645
  getInfo(): Promise<OpenFin.ApplicationInfo>;
295
646
  /**
296
647
  * Retrieves all process information for entities (windows and views) associated with an application.
297
- * @return {Promise.<AppProcessInfo>}
298
- * @tutorial Application.getProcessInfo
648
+ *
649
+ * @example
650
+ * ```js
651
+ * const app = await fin.Application.getCurrent();
652
+ * const processInfo = await app.getProcessInfo();
653
+ * ```
299
654
  * @experimental
300
655
  */
301
656
  getProcessInfo(): Promise<OpenFin.AppProcessInfo>;
@@ -303,19 +658,35 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
303
658
  * Sets file auto download location. It's only allowed in the same application.
304
659
  * Note: This method is restricted by default and must be enabled via
305
660
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
306
- * @param { string } downloadLocation file auto download location
307
- * @return {Promise.<void>}
661
+ * @param downloadLocation file auto download location
662
+ *
308
663
  * @throws if setting file auto download location on different applications.
309
- * @tutorial Application.setFileDownloadLocation
664
+ * @example
665
+ *
666
+ * ```js
667
+ * const downloadLocation = 'C:\\dev\\temp';
668
+ * const app = await fin.Application.getCurrent();
669
+ * try {
670
+ * await app.setFileDownloadLocation(downloadLocation);
671
+ * console.log('File download location is set');
672
+ * } catch(err) {
673
+ * console.error(err)
674
+ * }
675
+ * ```
310
676
  */
311
677
  setFileDownloadLocation(downloadLocation: string): Promise<void>;
312
678
  /**
313
679
  * 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.
314
680
  * Note: This method is restricted by default and must be enabled via
315
681
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
316
- * @return {Promise.<string>}
682
+ *
317
683
  * @throws if getting file auto download location on different applications.
318
- * @tutorial Application.getFileDownloadLocation
684
+ * @example
685
+ *
686
+ * ```js
687
+ * const app = await fin.Application.getCurrent();
688
+ * const fileDownloadDir = await app.getFileDownloadLocation();
689
+ * ```
319
690
  */
320
691
  getFileDownloadLocation(): Promise<string>;
321
692
  }