@openfin/core 33.76.27 → 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.27.tgz +0 -0
@@ -7,10 +7,13 @@ const events_1 = require("events");
7
7
  /**
8
8
  * An object representing the core of OpenFin Runtime. Allows the developer
9
9
  * to perform system-level actions, such as accessing logs, viewing processes,
10
- * clearing the cache and exiting the runtime as well as listen to <a href="tutorial-System.EventEmitter.html">system events</a>.
11
- * @namespace
10
+ * clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}.
11
+ *
12
12
  */
13
13
  class System extends base_1.EmitterBase {
14
+ /**
15
+ * @internal
16
+ */
14
17
  constructor(wire) {
15
18
  super(wire, 'system');
16
19
  }
@@ -61,10 +64,10 @@ class System extends base_1.EmitterBase {
61
64
  }
62
65
  /**
63
66
  * Adds a listener to the end of the listeners array for the specified event.
64
- * @param { string | symbol } eventType - The type of the event.
65
- * @param { Function } listener - Called whenever an event of the specified type occurs.
66
- * @param { SubOptions } [options] - Option to support event timestamps.
67
- * @return {Promise.<this>}
67
+ * @param eventType - The type of the event.
68
+ * @param listener - Called whenever an event of the specified type occurs.
69
+ * @param options - Option to support event timestamps.
70
+ *
68
71
  * @function addListener
69
72
  * @memberof System
70
73
  * @instance
@@ -72,10 +75,10 @@ class System extends base_1.EmitterBase {
72
75
  */
73
76
  /**
74
77
  * Adds a listener to the end of the listeners array for the specified event.
75
- * @param { string | symbol } eventType - The type of the event.
76
- * @param { Function } listener - Called whenever an event of the specified type occurs.
77
- * @param { SubOptions } [options] - Option to support event timestamps.
78
- * @return {Promise.<this>}
78
+ * @param eventType - The type of the event.
79
+ * @param listener - Called whenever an event of the specified type occurs.
80
+ * @param options - Option to support event timestamps.
81
+ *
79
82
  * @function on
80
83
  * @memberof System
81
84
  * @instance
@@ -83,10 +86,10 @@ class System extends base_1.EmitterBase {
83
86
  */
84
87
  /**
85
88
  * 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.
86
- * @param { string | symbol } eventType - The type of the event.
87
- * @param { Function } listener - The callback function.
88
- * @param { SubOptions } [options] - Option to support event timestamps.
89
- * @return {Promise.<this>}
89
+ * @param eventType - The type of the event.
90
+ * @param listener - The callback function.
91
+ * @param options - Option to support event timestamps.
92
+ *
90
93
  * @function once
91
94
  * @memberof System
92
95
  * @instance
@@ -94,10 +97,10 @@ class System extends base_1.EmitterBase {
94
97
  */
95
98
  /**
96
99
  * Adds a listener to the beginning of the listeners array for the specified event.
97
- * @param { string | symbol } eventType - The type of the event.
98
- * @param { Function } listener - The callback function.
99
- * @param { SubOptions } [options] - Option to support event timestamps.
100
- * @return {Promise.<this>}
100
+ * @param eventType - The type of the event.
101
+ * @param listener - The callback function.
102
+ * @param options - Option to support event timestamps.
103
+ *
101
104
  * @function prependListener
102
105
  * @memberof System
103
106
  * @instance
@@ -106,10 +109,10 @@ class System extends base_1.EmitterBase {
106
109
  /**
107
110
  * 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.
108
111
  * The listener is added to the beginning of the listeners array.
109
- * @param { string | symbol } eventType - The type of the event.
110
- * @param { Function } listener - The callback function.
111
- * @param { SubOptions } [options] - Option to support event timestamps.
112
- * @return {Promise.<this>}
112
+ * @param eventType - The type of the event.
113
+ * @param listener - The callback function.
114
+ * @param options - Option to support event timestamps.
115
+ *
113
116
  * @function prependOnceListener
114
117
  * @memberof System
115
118
  * @instance
@@ -118,10 +121,10 @@ class System extends base_1.EmitterBase {
118
121
  /**
119
122
  * Remove a listener from the listener array for the specified event.
120
123
  * Caution: Calling this method changes the array indices in the listener array behind the listener.
121
- * @param { string | symbol } eventType - The type of the event.
122
- * @param { Function } listener - The callback function.
123
- * @param { SubOptions } [options] - Option to support event timestamps.
124
- * @return {Promise.<this>}
124
+ * @param eventType - The type of the event.
125
+ * @param listener - The callback function.
126
+ * @param options - Option to support event timestamps.
127
+ *
125
128
  * @function removeListener
126
129
  * @memberof System
127
130
  * @instance
@@ -129,8 +132,8 @@ class System extends base_1.EmitterBase {
129
132
  */
130
133
  /**
131
134
  * Removes all listeners, or those of the specified event.
132
- * @param { string | symbol } [eventType] - The type of the event.
133
- * @return {Promise.<this>}
135
+ * @param eventType - The type of the event.
136
+ *
134
137
  * @function removeAllListeners
135
138
  * @memberof System
136
139
  * @instance
@@ -139,8 +142,11 @@ class System extends base_1.EmitterBase {
139
142
  /**
140
143
  * Returns the version of the runtime. The version contains the major, minor,
141
144
  * build and revision numbers.
142
- * @return {Promise.<string>}
143
- * @tutorial System.getVersion
145
+ *
146
+ * @example
147
+ * ```js
148
+ * fin.System.getVersion().then(v => console.log(v)).catch(err => console.log(err));
149
+ * ```
144
150
  */
145
151
  getVersion() {
146
152
  return this.wire.sendAction('get-version').then(({ payload }) => payload.data);
@@ -149,34 +155,59 @@ class System extends base_1.EmitterBase {
149
155
  * Clears cached data containing application resource
150
156
  * files (images, HTML, JavaScript files), cookies, and items stored in the
151
157
  * Local Storage.
152
- * @param { ClearCacheOption } options - See tutorial for more details.
153
- * @return {Promise.<void>}
154
- * @tutorial System.clearCache
158
+ * @param options - See below for details.
159
+ *
160
+ * @remarks For more information on the accepted options, see the following pages:
161
+ * * cache: browsing data cache for html files and images ([caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching))
162
+ * * cookies: browser [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)
163
+ * * localStorage: browser data that can be used across sessions ([local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage))
164
+ * * appcache: html5 [application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache)
165
+ * @example
166
+ * ```js
167
+ * const clearCacheOptions = {
168
+ * appcache: true,
169
+ * cache: true,
170
+ * cookies: true,
171
+ * localStorage: true
172
+ * };
173
+ * fin.System.clearCache(clearCacheOptions).then(() => console.log('Cache cleared')).catch(err => console.log(err));
174
+ * ```
175
+ *
155
176
  */
156
177
  clearCache(options) {
157
178
  return this.wire.sendAction('clear-cache', options).then(() => undefined);
158
179
  }
159
180
  /**
160
181
  * Clears all cached data when OpenFin Runtime exits.
161
- * @return {Promise.<void>}
162
- * @tutorial System.deleteCacheOnExit
182
+ *
183
+ * @example
184
+ * ```js
185
+ * fin.System.deleteCacheOnExit().then(() => console.log('Deleted Cache')).catch(err => console.log(err));
186
+ * ```
163
187
  */
164
188
  deleteCacheOnExit() {
165
189
  return this.wire.sendAction('delete-cache-request').then(() => undefined);
166
190
  }
167
191
  /**
168
192
  * Exits the Runtime.
169
- * @return {Promise.<void>}
170
- * @tutorial System.exit
193
+ *
194
+ * @example
195
+ * ```js
196
+ * fin.System.exit().then(() => console.log('exit')).catch(err => console.log(err));
197
+ * ```
171
198
  */
172
199
  exit() {
173
200
  return this.wire.sendAction('exit-desktop').then(() => undefined);
174
201
  }
175
202
  /**
176
203
  * Fetches a JSON manifest using the browser process and returns a Javascript object.
177
- * @param { string } manifestUrl The URL of the manifest to fetch.
178
- * @return {Promise.<any>}
179
- * @tutorial System.fetchManifest
204
+ * @param manifestUrl The URL of the manifest to fetch.
205
+ *
206
+ * @example
207
+ * ```js
208
+ * const manifest = await fin.System.fetchManifest('https://www.path-to-manifest.com');
209
+ * console.log(manifest);
210
+ * ```
180
211
  */
181
212
  async fetchManifest(manifestUrl) {
182
213
  const { payload: { data } } = await this.wire.sendAction('fetch-manifest', { manifestUrl });
@@ -184,40 +215,57 @@ class System extends base_1.EmitterBase {
184
215
  }
185
216
  /**
186
217
  * Writes any unwritten cookies data to disk.
187
- * @return {Promise.<void>}
188
- * @tutorial System.flushCookieStore
218
+ *
219
+ * @example
220
+ * ```js
221
+ * fin.System.flushCookieStore()
222
+ * .then(() => console.log('success'))
223
+ * .catch(err => console.error(err));
224
+ * ```
189
225
  */
190
226
  flushCookieStore() {
191
227
  return this.wire.sendAction('flush-cookie-store').then(() => undefined);
192
228
  }
193
229
  /**
194
230
  * Retrieves an array of data (name, ids, bounds) for all application windows.
195
- * @return {Promise.Array.<ApplicationWindowInfo>}
196
- * @tutorial System.getAllWindows
231
+ *
232
+ * @example
233
+ * ```js
234
+ * fin.System.getAllWindows().then(wins => console.log(wins)).catch(err => console.log(err));
235
+ * ```
197
236
  */
198
237
  getAllWindows() {
199
238
  return this.wire.sendAction('get-all-windows').then(({ payload }) => payload.data);
200
239
  }
201
240
  /**
202
241
  * Retrieves an array of data for all applications.
203
- * @return {Promise.Array.<ApplicationState>}
204
- * @tutorial System.getAllApplications
242
+ *
243
+ * @example
244
+ * ```js
245
+ * fin.System.getAllApplications().then(apps => console.log(apps)).catch(err => console.log(err));
246
+ * ```
205
247
  */
206
248
  getAllApplications() {
207
249
  return this.wire.sendAction('get-all-applications').then(({ payload }) => payload.data);
208
250
  }
209
251
  /**
210
252
  * Retrieves the command line argument string that started OpenFin Runtime.
211
- * @return {Promise.<string>}
212
- * @tutorial System.getCommandLineArguments
253
+ *
254
+ * @example
255
+ * ```js
256
+ * fin.System.getCommandLineArguments().then(args => console.log(args)).catch(err => console.log(err));
257
+ * ```
213
258
  */
214
259
  getCommandLineArguments() {
215
260
  return this.wire.sendAction('get-command-line-arguments').then(({ payload }) => payload.data);
216
261
  }
217
262
  /**
218
263
  * Get the current state of the crash reporter.
219
- * @return {Promise.<CrashReporterState>}
220
- * @tutorial System.getCrashReporterState
264
+ *
265
+ * @example
266
+ * ```js
267
+ * fin.System.getCrashReporterState().then(state => console.log(state)).catch(err => console.log(err));
268
+ * ```
221
269
  */
222
270
  async getCrashReporterState() {
223
271
  const { payload: { data: { diagnosticMode, isRunning } } } = await this.wire.sendAction('get-crash-reporter-state');
@@ -231,9 +279,17 @@ class System extends base_1.EmitterBase {
231
279
  }
232
280
  /**
233
281
  * Start the crash reporter if not already running.
234
- * @param { CrashReporterOptions } options - configure crash reporter
235
- * @return {Promise.<CrashReporterState>}
236
- * @tutorial System.startCrashReporter
282
+ * @param options - configure crash reporter
283
+ *
284
+ * @remarks You can optionally specify `diagnosticsMode` to have the logs sent to
285
+ * OpenFin on runtime close. (NOTE: `diagnosticsMode` will turn on verbose logging and disable the sandbox
286
+ * for newly launched renderer processes. See https://developers.openfin.co/of-docs/docs/debugging#diagnostics-mode for
287
+ * more details.)
288
+ *
289
+ * @example
290
+ * ```js
291
+ * fin.System.startCrashReporter({diagnosticsMode: true}).then(reporter => console.log(reporter)).catch(err => console.log(err));
292
+ * ```
237
293
  */
238
294
  async startCrashReporter(options) {
239
295
  const opts = options;
@@ -249,8 +305,16 @@ class System extends base_1.EmitterBase {
249
305
  /**
250
306
  * Returns a hex encoded hash of the machine id and the currently logged in user name.
251
307
  * This is the recommended way to uniquely identify a user / machine combination.
252
- * @return {Promise.<string>}
253
- * @tutorial System.getUniqueUserId
308
+ *
309
+ * @remarks For Windows systems this is a sha256 hash of the machine ID set in the registry key:
310
+ * `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid` and `USERNAME`.
311
+ *
312
+ * For OSX systems, a native-level call is used to get the machine ID.
313
+ *
314
+ * @example
315
+ * ```js
316
+ * fin.System.getUniqueUserId().then(id => console.log(id)).catch(err => console.log(err));
317
+ * ```
254
318
  * @static
255
319
  */
256
320
  getUniqueUserId() {
@@ -258,18 +322,38 @@ class System extends base_1.EmitterBase {
258
322
  }
259
323
  /**
260
324
  * Retrieves a frame info object for the uuid and name passed in
261
- * @param { string } uuid - The UUID of the target.
262
- * @param { string } name - The name of the target.
263
- * @return {Promise.<EntityInfo>}
264
- * @tutorial System.getEntityInfo
325
+ * @param uuid - The UUID of the target.
326
+ * @param name - The name of the target.
327
+ *
328
+ * @remarks The possible types are 'window', 'iframe', 'external connection' or 'unknown'.
329
+ * @example
330
+ * ```js
331
+ * const entityUuid = 'OpenfinPOC';
332
+ * const entityName = '40c74b5d-ed98-40f7-853f-e3d3c2699175';
333
+ * fin.System.getEntityInfo(entityUuid, entityName).then(info => console.log(info)).catch(err => console.log(err));
334
+ *
335
+ * // example info shape
336
+ * {
337
+ * "uuid": "OpenfinPOC",
338
+ * "name": "40c74b5d-ed98-40f7-853f-e3d3c2699175",
339
+ * "parent": {
340
+ * "uuid": "OpenfinPOC",
341
+ * "name": "OpenfinPOC"
342
+ * },
343
+ * "entityType": "iframe"
344
+ * }
345
+ * ```
265
346
  */
266
347
  getEntityInfo(uuid, name) {
267
348
  return this.wire.sendAction('get-entity-info', { uuid, name }).then(({ payload }) => payload.data);
268
349
  }
269
350
  /**
270
351
  * Gets the value of a given environment variable on the computer on which the runtime is installed
271
- * @return {Promise.<string>}
272
- * @tutorial System.getEnvironmentVariable
352
+ *
353
+ * @example
354
+ * ```js
355
+ * fin.System.getEnvironmentVariable('HOME').then(env => console.log(env)).catch(err => console.log(err));
356
+ * ```
273
357
  */
274
358
  getEnvironmentVariable(envName) {
275
359
  return this.wire
@@ -280,16 +364,27 @@ class System extends base_1.EmitterBase {
280
364
  }
281
365
  /**
282
366
  * Get current focused window.
283
- * @return {Promise.<Identity | null>}
284
- * @tutorial System.getFocusedWindow
367
+ *
368
+ * @example
369
+ * ```js
370
+ * fin.System.getFocusedWindow().then(winInfo => console.log(winInfo)).catch(err => console.log(err));
371
+ * ```
285
372
  */
286
373
  getFocusedWindow() {
287
374
  return this.wire.sendAction('get-focused-window').then(({ payload }) => payload.data);
288
375
  }
289
376
  /**
290
377
  * Returns information about the given app's certification status
291
- * @return {Promise.<CertifiedAppInfo>}
292
- * @tutorial System.isAppCertified
378
+ *
379
+ * @example
380
+ * ```js
381
+ * const manifestUrl = "http://localhost:1234/app.json"
382
+ * try {
383
+ * const certificationInfo = await fin.System.isAppCertified(manifestUrl);
384
+ * } catch(err) {
385
+ * console.error(err)
386
+ * }
387
+ * ```
293
388
  */
294
389
  async isAppCertified(manifestUrl) {
295
390
  const { payload: { data: { certifiedInfo } } } = await this.wire.sendAction('is-app-certified', { manifestUrl });
@@ -297,8 +392,11 @@ class System extends base_1.EmitterBase {
297
392
  }
298
393
  /**
299
394
  * Returns an array of all the installed runtime versions in an object.
300
- * @return {Promise.<string[]>}
301
- * @tutorial System.getInstalledRuntimes
395
+ *
396
+ * @example
397
+ * ```js
398
+ * fin.System.getInstalledRuntimes().then(runtimes => console.log(runtimes)).catch(err => console.log(err));
399
+ * ```
302
400
  */
303
401
  // incompatible with standalone node process.
304
402
  getInstalledRuntimes() {
@@ -311,33 +409,50 @@ class System extends base_1.EmitterBase {
311
409
  }
312
410
  /**
313
411
  * Retrieves the contents of the log with the specified filename.
314
- * @param { GetLogRequestType } options A object that id defined by the GetLogRequestType interface
315
- * @return {Promise.<string>}
316
- * @tutorial System.getLog
412
+ * @param options A object that id defined by the GetLogRequestType interface
413
+ *
414
+ * @example
415
+ * ```js
416
+ * async function getLog() {
417
+ * const logs = await fin.System.getLogList();
418
+ * return await fin.System.getLog(logs[0]);
419
+ * }
420
+ *
421
+ * getLog().then(log => console.log(log)).catch(err => console.log(err));
422
+ * ```
317
423
  */
318
424
  getLog(options) {
319
425
  return this.wire.sendAction('view-log', options).then(({ payload }) => payload.data);
320
426
  }
321
427
  /**
322
428
  * Returns a unique identifier (UUID) provided by the machine.
323
- * @return {Promise.<string>}
324
- * @tutorial System.getMachineId
429
+ *
430
+ * @example
431
+ * ```js
432
+ * fin.System.getMachineId().then(id => console.log(id)).catch(err => console.log(err));
433
+ * ```
325
434
  */
326
435
  getMachineId() {
327
436
  return this.wire.sendAction('get-machine-id').then(({ payload }) => payload.data);
328
437
  }
329
438
  /**
330
439
  * Returns the minimum (inclusive) logging level that is currently being written to the log.
331
- * @return {Promise.<LogLevel>}
332
- * @tutorial System.getMinLogLevel
440
+ *
441
+ * @example
442
+ * ```js
443
+ * fin.System.getMinLogLevel().then(level => console.log(level)).catch(err => console.log(err));
444
+ * ```
333
445
  */
334
446
  getMinLogLevel() {
335
447
  return this.wire.sendAction('get-min-log-level').then(({ payload }) => payload.data);
336
448
  }
337
449
  /**
338
450
  * Retrieves an array containing information for each log file.
339
- * @return {Promise.Array<LogInfo>}
340
- * @tutorial System.getLogList
451
+ *
452
+ * @example
453
+ * ```js
454
+ * fin.System.getLogList().then(logList => console.log(logList)).catch(err => console.log(err));
455
+ * ```
341
456
  */
342
457
  getLogList() {
343
458
  return this.wire.sendAction('list-logs').then(({ payload }) => payload.data);
@@ -345,16 +460,22 @@ class System extends base_1.EmitterBase {
345
460
  /**
346
461
  * Retrieves an object that contains data about the monitor setup of the
347
462
  * computer that the runtime is running on.
348
- * @return {Promise.<MonitorInfo>}
349
- * @tutorial System.getMonitorInfo
463
+ *
464
+ * @example
465
+ * ```js
466
+ * fin.System.getMonitorInfo().then(monitorInfo => console.log(monitorInfo)).catch(err => console.log(err));
467
+ * ```
350
468
  */
351
469
  getMonitorInfo() {
352
470
  return this.wire.sendAction('get-monitor-info').then(({ payload }) => payload.data);
353
471
  }
354
472
  /**
355
473
  * Returns the mouse in virtual screen coordinates (left, top).
356
- * @return {Promise.<PointTopLeft>}
357
- * @tutorial System.getMousePosition
474
+ *
475
+ * @example
476
+ * ```js
477
+ * fin.System.getMousePosition().then(mousePosition => console.log(mousePosition)).catch(err => console.log(err));
478
+ * ```
358
479
  */
359
480
  getMousePosition() {
360
481
  return this.wire.sendAction('get-mouse-position').then(({ payload }) => payload.data);
@@ -364,12 +485,15 @@ class System extends base_1.EmitterBase {
364
485
  * running. Each element in the array is an object containing the uuid
365
486
  * and the name of the application to which the process belongs.
366
487
  * @deprecated Please use our new set of process APIs:
367
- * [Window.getProcessInfo]{@link Window#getProcessInfo}
368
- * [View.getProcessInfo]{@link View#getProcessInfo}
369
- * [Application.getProcessInfo]{@link Application#getProcessInfo}
370
- * [System.getAllProcessInfo]{@link System#getAllProcessInfo}
371
- * @return {Promise.Array.<ProcessInfo>}
372
- * @tutorial System.getProcessList
488
+ * {@link Window._Window#getProcessInfo Window.getProcessInfo}
489
+ * {@link View.View#getProcessInfo View.getProcessInfo}
490
+ * {@link Application.Application#getProcessInfo Application.getProcessInfo}
491
+ * {@link System#getAllProcessInfo System.getAllProcessInfo}
492
+ *
493
+ * @example
494
+ * ```js
495
+ * fin.System.getProcessList().then(ProcessList => console.log(ProcessList)).catch(err => console.log(err));
496
+ * ```
373
497
  */
374
498
  getProcessList() {
375
499
  // eslint-disable-next-line no-console
@@ -377,9 +501,14 @@ class System extends base_1.EmitterBase {
377
501
  return this.wire.sendAction('process-snapshot').then(({ payload }) => payload.data);
378
502
  }
379
503
  /**
380
- * Retrieves all process information. This includes the browser process and every process associated to all entities (windows and views).
381
- * @return {Promise.<SystemProcessInfo>}
382
- * @tutorial System.getAllProcessInfo
504
+ * Retrieves all process information.
505
+ *
506
+ * @remarks This includes the browser process and every process associated to all entities (windows and views).
507
+ *
508
+ * @example
509
+ * ```js
510
+ * const allProcessInfo = await fin.System.getAllProcessInfo();
511
+ * ```
383
512
  * @experimental
384
513
  */
385
514
  async getAllProcessInfo() {
@@ -388,24 +517,48 @@ class System extends base_1.EmitterBase {
388
517
  }
389
518
  /**
390
519
  * Retrieves the Proxy settings.
391
- * @return {Promise.<ProxyInfo>}
392
- * @tutorial System.getProxySettings
520
+ *
521
+ * @example
522
+ * ```js
523
+ * fin.System.getProxySettings().then(ProxySetting => console.log(ProxySetting)).catch(err => console.log(err));
524
+ *
525
+ * //This response has the following shape:
526
+ * {
527
+ * config: {
528
+ * proxyAddress: "proxyAddress", //the configured Proxy Address
529
+ * proxyPort: 0, //the configured Proxy port
530
+ * type: "system" //Proxy Type
531
+ * },
532
+ * system: {
533
+ * autoConfigUrl: "",
534
+ * bypass: "",
535
+ * enabled: false,
536
+ * proxy: ""
537
+ * }
538
+ * }
539
+ * ```
393
540
  */
394
541
  getProxySettings() {
395
542
  return this.wire.sendAction('get-proxy-settings').then(({ payload }) => payload.data);
396
543
  }
397
544
  /**
398
545
  * Returns information about the running Runtime in an object.
399
- * @return {Promise.<RuntimeInfo>}
400
- * @tutorial System.getRuntimeInfo
546
+ *
547
+ * @example
548
+ * ```js
549
+ * fin.System.getRuntimeInfo().then(RuntimeInfo => console.log(RuntimeInfo)).catch(err => console.log(err));
550
+ * ```
401
551
  */
402
552
  getRuntimeInfo() {
403
553
  return this.wire.sendAction('get-runtime-info').then(({ payload }) => payload.data);
404
554
  }
405
555
  /**
406
556
  * Returns information about the running RVM in an object.
407
- * @return {Promise.<RVMInfo>}
408
- * @tutorial System.getRvmInfo
557
+ *
558
+ * @example
559
+ * ```js
560
+ * fin.System.getRvmInfo().then(RvmInfo => console.log(RvmInfo)).catch(err => console.log(err));
561
+ * ```
409
562
  */
410
563
  // incompatible with standalone node process.
411
564
  getRvmInfo() {
@@ -413,8 +566,11 @@ class System extends base_1.EmitterBase {
413
566
  }
414
567
  /**
415
568
  * Retrieves system information.
416
- * @return {Promise.<HostSpecs>}
417
- * @tutorial System.getHostSpecs
569
+ *
570
+ * @example
571
+ * ```js
572
+ * fin.System.getHostSpecs().then(specs => console.log(specs)).catch(err => console.log(err));
573
+ * ```
418
574
  */
419
575
  getHostSpecs() {
420
576
  return this.wire.sendAction('get-host-specs').then(({ payload }) => payload.data);
@@ -424,9 +580,329 @@ class System extends base_1.EmitterBase {
424
580
  * <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
425
581
  * <br> Note: This method is restricted by default and must be enabled via
426
582
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>. Also, this api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the assets owned by the application, the enabled downloaded files or the restricted executables.
427
- * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
428
- * @return {Promise.<Identity>}
429
- * @tutorial System.launchExternalProcess
583
+ * @param options A object that is defined in the ExternalProcessRequestType interface
584
+ *
585
+ * @remarks If an unused UUID is provided in options, it will be used. If no UUID is provided, OpenFin will assign one.
586
+ * This api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the
587
+ * assets owned by the application, the enabled downloaded files or the restricted executables.
588
+ *
589
+ * **Note:** Since _appAssets_ relies on the RVM, which is missing on MAC_OS, 'alias' is not available. Instead provide
590
+ * the full path e.g. _/Applications/Calculator.app/Contents/MacOS/Calculator_.
591
+ *
592
+ * @example
593
+ * Basic Example:
594
+ * ```js
595
+ * fin.System.launchExternalProcess({
596
+ * path: 'notepad',
597
+ * arguments: '',
598
+ * listener: function (result) {
599
+ * console.log('the exit code', result.exitCode);
600
+ * }
601
+ * }).then(processIdentity => {
602
+ * console.log(processIdentity);
603
+ * }).catch(error => {
604
+ * console.log(error);
605
+ * });
606
+ * ```
607
+ *
608
+ * Promise resolution:
609
+ *
610
+ * ```js
611
+ * //This response has the following shape:
612
+ * {
613
+ * uuid: "FB3E6E36-0976-4C2B-9A09-FB2E54D2F1BB" // The mapped UUID which identifies the launched process
614
+ * }
615
+ * ```
616
+ *
617
+ * Listener callback:
618
+ * ```js
619
+ * //This response has the following shape:
620
+ * {
621
+ * topic: "exited", // Or "released" on a call to releaseExternalProcess
622
+ * uuid: "FB3E6E36-0976-4C2B-9A09-FB2E54D2F1BB", // The mapped UUID which identifies the launched process
623
+ * exitCode: 0 // Process exit code
624
+ * }
625
+ * ```
626
+ *
627
+ * By specifying a lifetime, an external process can live as long the window/application that launched it or
628
+ * persist after the application exits. The default value is null, which is equivalent to 'persist', meaning
629
+ * the process lives on after the application exits:
630
+ *
631
+ * ```js
632
+ * fin.System.launchExternalProcess({
633
+ * path: 'notepad',
634
+ * arguments: '',
635
+ * listener: (result) => {
636
+ * console.log('the exit code', result.exitCode);
637
+ * },
638
+ * lifetime: 'window'
639
+ * }).then(processIdentity => {
640
+ * console.log(processIdentity);
641
+ * }).catch(error => {
642
+ * console.log(error);
643
+ * });
644
+ * ```
645
+ *
646
+ * Note: A process that exits when the window/application exits cannot be released via fin.desktop.System.releaseExternalProcess.
647
+ *
648
+ * By specifying a cwd, it will set current working directory when launching an external process:
649
+ *
650
+ * ```js
651
+ * fin.System.launchExternalProcess({
652
+ * path: 'cmd.exe',
653
+ * cwd: 'c:\\temp',
654
+ * arguments: '',
655
+ * listener: (result) => {
656
+ * console.log('the exit code', result.exitCode);
657
+ * }
658
+ * }).then(processIdentity => {
659
+ * console.log(processIdentity);
660
+ * }).catch(error => {
661
+ * console.log(error);
662
+ * });
663
+ * ```
664
+ *
665
+ * Example using an alias from app.json appAssets property:
666
+ *
667
+ * ```json
668
+ * "appAssets": [
669
+ * {
670
+ * "src": "exe.zip",
671
+ * "alias": "myApp",
672
+ * "version": "4.12.8",
673
+ * "target": "myApp.exe",
674
+ * "args": "a b c d"
675
+ * },
676
+ * ]
677
+ * ```
678
+ *
679
+ * ```js
680
+ * // When called, if no arguments are passed then the arguments (if any)
681
+ * // are taken from the 'app.json' file, from the 'args' parameter
682
+ * // of the 'appAssets' Object with the relevant 'alias'.
683
+ * fin.System.launchExternalProcess({
684
+ * //Additionally note that the executable found in the zip file specified in appAssets
685
+ * //will default to the one mentioned by appAssets.target
686
+ * //If the the path below refers to a specific path it will override this default
687
+ * alias: 'myApp',
688
+ * listener: (result) => {
689
+ * console.log('the exit code', result.exitCode);
690
+ * }
691
+ * }).then(processIdentity => {
692
+ * console.log(processIdentity);
693
+ * }).catch(error => {
694
+ * console.log(error);
695
+ * });
696
+ * ```
697
+ *
698
+ * Example using an alias but overriding the arguments:
699
+ *
700
+ * ```json
701
+ * "appAssets": [
702
+ * {
703
+ * "src": "exe.zip",
704
+ * "alias": "myApp",
705
+ * "version": "4.12.8",
706
+ * "target": "myApp.exe",
707
+ * "args": "a b c d"
708
+ * },
709
+ * ]
710
+ * ```
711
+ *
712
+ * ```js
713
+ * // If 'arguments' is passed as a parameter it takes precedence
714
+ * // over any 'args' set in the 'app.json'.
715
+ * fin.System.launchExternalProcess({
716
+ * alias: 'myApp',
717
+ * arguments: 'e f g',
718
+ * listener: (result) => {
719
+ * console.log('the exit code', result.exitCode);
720
+ * }
721
+ * }).then(processIdentity => {
722
+ * console.log(processIdentity);
723
+ * }).catch(error => {
724
+ * console.log(error);
725
+ * });
726
+ * ```
727
+ *
728
+ * It is now possible to optionally perform any combination of the following certificate checks
729
+ * against an absolute target via `fin.desktop.System.launchExternalProcess()`:
730
+ *
731
+ * ```js
732
+ * "certificate": {
733
+ * "serial": "3c a5 ...", // A hex string with or without spaces
734
+ * "subject": "O=OpenFin INC., L=New York, ...", // An internally tokenized and comma delimited string allowing partial or full checks of the subject fields
735
+ * "publickey": "3c a5 ...", // A hex string with or without spaces
736
+ * "thumbprint": "3c a5 ...", // A hex string with or without spaces
737
+ * "trusted": true // A boolean indicating that the certificate is trusted and not revoked
738
+ * }
739
+ * ```
740
+ *
741
+ * Providing this information as part of the default configurations for assets in an application's manifest
742
+ * will be added in a future RVM update:
743
+ *
744
+ * ```js
745
+ * fin.System.launchExternalProcess({
746
+ * path: 'C:\\Users\\ExampleUser\\AppData\\Local\\OpenFin\\OpenFinRVM.exe',
747
+ * arguments: '--version',
748
+ * certificate: {
749
+ * trusted: true,
750
+ * subject: 'O=OpenFin INC., L=New York, S=NY, C=US',
751
+ * thumbprint: '‎3c a5 28 19 83 05 fe 69 88 e6 8f 4b 3a af c5 c5 1b 07 80 5b'
752
+ * },
753
+ * listener: (result) => {
754
+ * console.log('the exit code', result.exitCode);
755
+ * }
756
+ * }).then(processIdentity => {
757
+ * console.log(processIdentity);
758
+ * }).catch(error => {
759
+ * console.log(error);
760
+ * });
761
+ * ```
762
+ *
763
+ * It is possible to launch files that have been downloaded by the user by listening to the window
764
+ * `file-download-completed` event and using the `fileUuid` provided by the event:
765
+ *
766
+ * ```js
767
+ * const win = fin.Window.getCurrentSync();
768
+ * win.addListener('file-download-completed', (evt) => {
769
+ * if (evt.state === 'completed') {
770
+ * fin.System.launchExternalProcess({
771
+ * fileUuid: evt.fileUuid,
772
+ * arguments: '',
773
+ * listener: (result) => {
774
+ * console.log('the exit code', result.exitCode);
775
+ * }
776
+ * }).then(processIdentity => {
777
+ * console.log(processIdentity);
778
+ * }).catch(error => {
779
+ * console.log(error);
780
+ * });
781
+ * }
782
+ * });
783
+ * ```
784
+ *
785
+ * Launching assets specified in the app manifest:
786
+ *
787
+ * Sample appAssets section in app.json
788
+ * ```js
789
+ * "appAssets": [
790
+ * {
791
+ * "src": "http://filesamples.com/exe.zip",
792
+ * "alias": "myApp",
793
+ * "version": "4.12.8",
794
+ * "target": "myApp.exe",
795
+ * "args": "a b c d"
796
+ * },
797
+ * {
798
+ * "src": "http://examples.com/exe.zip",
799
+ * "alias": "myApp2",
800
+ * "version": "5.12.8",
801
+ * "target": "myApp2.exe",
802
+ * "args": "a b c"
803
+ * }
804
+ * ]
805
+ * ```
806
+ *
807
+ * This permission allows for launching of all assets specified in the above appAssets section. ("myApp" and "myApp2"):
808
+ *
809
+ * ```js
810
+ * "permissions": {
811
+ * "System": {
812
+ * "launchExternalProcess": {
813
+ * "enabled": true,
814
+ * "assets": {
815
+ * "enabled": true
816
+ * }
817
+ * }
818
+ * }
819
+ * }
820
+ * ```
821
+ *
822
+ * This permission allows for launching of _only_ the "myApp" asset in the above appAssets section, as defined in `srcRules`:
823
+ * ```js
824
+ * "permissions": {
825
+ * "System": {
826
+ * "launchExternalProcess": {
827
+ * "enabled": true,
828
+ * "assets": {
829
+ * "enabled": true
830
+ * "srcRules": [
831
+ * {
832
+ * "match": [
833
+ * "*://filesamples.com/*"
834
+ * ],
835
+ * "behavior": "allow"
836
+ * },
837
+ * {
838
+ * "match": [
839
+ * "<all_urls>"
840
+ * ],
841
+ * "behavior": "block"
842
+ * }
843
+ * ]
844
+ * }
845
+ * }
846
+ * }
847
+ * }
848
+ * ```
849
+ *
850
+ * Launching downloaded files:
851
+ * ```js
852
+ * "permissions": {
853
+ * "System": {
854
+ * "launchExternalProcess": {
855
+ * "enabled": true,
856
+ * "downloads": {
857
+ * "enabled": true
858
+ * }
859
+ * }
860
+ * }
861
+ * }
862
+ * ```
863
+ *
864
+ * This permission allows to launch all the executables:
865
+ * ```js
866
+ * "permissions": {
867
+ * "System": {
868
+ * "launchExternalProcess": {
869
+ * "enabled": true,
870
+ * "executables": {
871
+ * "enabled": true
872
+ * }
873
+ * }
874
+ * }
875
+ * }
876
+ * ```
877
+ *
878
+ *
879
+ * This permission only allows launching of executables whose file paths match the corresponding `pathRules`:
880
+ * ```js
881
+ * "permissions": {
882
+ * "System": {
883
+ * "launchExternalProcess": {
884
+ * "enabled": true,
885
+ * "executables": {
886
+ * "enabled": true
887
+ * "pathRules": [
888
+ * {
889
+ * "match": [
890
+ * "/Windows/System32/*.exe"
891
+ * ],
892
+ * "behavior": "allow"
893
+ * },
894
+ * {
895
+ * "match": [
896
+ * "*.exe"
897
+ * ],
898
+ * "behavior": "block"
899
+ * }
900
+ * ]
901
+ * }
902
+ * }
903
+ * }
904
+ * }
905
+ * ```
430
906
  */
431
907
  launchExternalProcess(options) {
432
908
  return this.sendExternalProcessRequest('launch-external-process', options);
@@ -434,31 +910,67 @@ class System extends base_1.EmitterBase {
434
910
  /**
435
911
  * Monitors a running process. A pid for the process must be included in options.
436
912
  * <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
437
- * @param { ExternalProcessInfo } options See tutorial for more details
438
- * @return {Promise.<Identity>}
439
- * @tutorial System.monitorExternalProcess
913
+ * @param options See tutorial for more details
914
+ *
915
+ * @remarks If an unused uuid is provided in options, it will be used. If no uuid is provided, OpefinFin will assign a uuid.
916
+ * @example
917
+ * ```js
918
+ * fin.System.monitorExternalProcess({
919
+ * pid: 10208,
920
+ * uuid: 'my-external-process', // optional
921
+ * listener: function (result) {
922
+ * console.log('the exit code', result.exitCode);
923
+ * }
924
+ * }).then(processIdentity => console.log(processIdentity)).catch(err => console.log(err));
925
+ * ```
440
926
  */
441
927
  monitorExternalProcess(options) {
442
928
  return this.sendExternalProcessRequest('monitor-external-process', options);
443
929
  }
444
930
  /**
445
931
  * Writes the passed message into both the log file and the console.
446
- * @param { string } level The log level for the entry. Can be either "info", "warning" or "error"
447
- * @param { string } message The log message text
448
- * @return {Promise.<void>}
449
- * @tutorial System.log
932
+ * @param level The log level for the entry. Can be either "info", "warning" or "error"
933
+ * @param message The log message text
934
+ *
935
+ * @example
936
+ * ```js
937
+ * fin.System.log("info", "An example log message").then(() => console.log('Log info message')).catch(err => console.log(err));
938
+ * ```
450
939
  */
451
940
  log(level, message) {
452
941
  return this.wire.sendAction('write-to-log', { level, message }).then(() => undefined);
453
942
  }
454
943
  /**
455
- * Opens the passed URL in the default web browser. It only supports http(s) and fin(s) protocols by default.
944
+ * Opens the passed URL in the default web browser.
945
+ *
946
+ * @remarks It only supports http(s) and fin(s) protocols by default.
456
947
  * In order to use other custom protocols, they have to be enabled via
457
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
948
+ * [API security settings](https://developers.openfin.co/docs/api-security).
458
949
  * File protocol and file path are not supported.
459
- * @param { string } url The URL to open
460
- * @return {Promise.<void>}
461
- * @tutorial System.openUrlWithBrowser
950
+ * @param url The URL to open
951
+ *
952
+ * @example
953
+ * ```js
954
+ * fin.System.openUrlWithBrowser('https://cdn.openfin.co/docs/javascript/stable/tutorial-System.openUrlWithBrowser.html')
955
+ * .then(() => console.log('Opened URL'))
956
+ * .catch(err => console.log(err));
957
+ * ```
958
+ *
959
+ * Example of permission definition to enable non-default protocols:
960
+ *
961
+ * Note: permission definition should be specified in an app manifest file if there is no DOS settings.
962
+ * Otherwise it has to be specified in both DOS and app manifest files.
963
+ *
964
+ * ```js
965
+ * "permissions": {
966
+ * "System": {
967
+ * "openUrlWithBrowser": {
968
+ * "enabled": true,
969
+ * "protocols": [ "msteams", "slack"]
970
+ * }
971
+ * }
972
+ * }
973
+ * ```
462
974
  */
463
975
  openUrlWithBrowser(url) {
464
976
  return this.wire.sendAction('open-url-with-browser', { url }).then(() => undefined);
@@ -466,17 +978,28 @@ class System extends base_1.EmitterBase {
466
978
  /**
467
979
  * Removes the process entry for the passed UUID obtained from a prior call
468
980
  * of fin.System.launchExternalProcess().
469
- * @param { string } uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess()
470
- * @return {Promise.<void>}
471
- * @tutorial System.releaseExternalProcess
981
+ * @param uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess()
982
+ *
983
+ * @example
984
+ * ```js
985
+ * fin.System.launchExternalProcess({
986
+ * path: "notepad",
987
+ * listener: function (result) {
988
+ * console.log("The exit code", result.exitCode);
989
+ * }
990
+ * })
991
+ * .then(identity => fin.System.releaseExternalProcess(identity.uuid))
992
+ * .then(() => console.log('Process has been unmapped!'))
993
+ * .catch(err => console.log(err));
994
+ * ```
472
995
  */
473
996
  releaseExternalProcess(uuid) {
474
997
  return this.wire.sendAction('release-external-process', { uuid }).then(() => undefined);
475
998
  }
476
999
  /**
477
1000
  * Shows the Chromium Developer Tools for the specified window
478
- * @param { Identity } identity This is a object that is defined by the Identity interface
479
- * @return {Promise.<void>}
1001
+ * @param identity This is a object that is defined by the Identity interface
1002
+ *
480
1003
  * @tutorial System.showDeveloperTools
481
1004
  */
482
1005
  showDeveloperTools(identity) {
@@ -487,18 +1010,34 @@ class System extends base_1.EmitterBase {
487
1010
  * has not closed after the elapsed timeout in milliseconds.<br>
488
1011
  * Note: This method is restricted by default and must be enabled via
489
1012
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
490
- * @param { TerminateExternalRequestType } options A object defined in the TerminateExternalRequestType interface
491
- * @return {Promise.<void>}
492
- * @tutorial System.terminateExternalProcess
1013
+ * @param options A object defined in the TerminateExternalRequestType interface
1014
+ *
1015
+ * @example
1016
+ * ```js
1017
+ * fin.System.launchExternalProcess({
1018
+ * path: "notepad",
1019
+ * listener: function (result) {
1020
+ * console.log("The exit code", result.exitCode);
1021
+ * }
1022
+ * })
1023
+ * .then(identity => fin.System.terminateExternalProcess({uuid: identity.uuid, timeout:2000, killTree: false}))
1024
+ * .then(() => console.log('Terminate the process'))
1025
+ * .catch(err => console.log(err));
1026
+ * ```
493
1027
  */
494
1028
  terminateExternalProcess(options) {
495
1029
  return this.wire.sendAction('terminate-external-process', options).then(() => undefined);
496
1030
  }
497
1031
  /**
498
1032
  * Update the OpenFin Runtime Proxy settings.
499
- * @param { ProxyConfig } options A config object defined in the ProxyConfig interface
500
- * @return {Promise.<void>}
501
- * @tutorial System.updateProxySettings
1033
+ * @param options A config object defined in the ProxyConfig interface
1034
+ *
1035
+ * @example
1036
+ * ```js
1037
+ * fin.System.updateProxySettings({proxyAddress:'127.0.0.1', proxyPort:8080, type:'http'})
1038
+ * .then(() => console.log('Update proxy successfully'))
1039
+ * .catch(err => console.error(err));
1040
+ * ```
502
1041
  */
503
1042
  updateProxySettings(options) {
504
1043
  return this.wire.sendAction('update-proxy', options).then(() => undefined);
@@ -507,9 +1046,30 @@ class System extends base_1.EmitterBase {
507
1046
  * Downloads the given application asset<br>
508
1047
  * Note: This method is restricted by default and must be enabled via
509
1048
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
510
- * @param { AppAssetInfo } appAsset App asset object
511
- * @return {Promise.<void>}
512
- * @tutorial System.downloadAsset
1049
+ * @param appAsset App asset object
1050
+ *
1051
+ * @example
1052
+ * ```js
1053
+ * async function downloadAsset() {
1054
+ * const appAsset = {
1055
+ * src: `${ location.origin }/assets.zip`,
1056
+ * alias: 'dirApp',
1057
+ * version: '1.23.24',
1058
+ * target: 'assets/run.bat'
1059
+ * };
1060
+ *
1061
+ * return fin.System.downloadAsset(appAsset, (progress => {
1062
+ * //Print progress as we download the asset.
1063
+ * const downloadedPercent = Math.floor((progress.downloadedBytes / progress.totalBytes) * 100);
1064
+ * console.log(`Downloaded ${downloadedPercent}%`);
1065
+ * }));
1066
+ * }
1067
+ *
1068
+ * downloadAsset()
1069
+ * .then(() => console.log('Success'))
1070
+ * .catch(err => console.error(err));
1071
+ *
1072
+ * ```
513
1073
  */
514
1074
  // incompatible with standalone node process.
515
1075
  async downloadAsset(appAsset, progressListener) {
@@ -571,10 +1131,29 @@ class System extends base_1.EmitterBase {
571
1131
  }
572
1132
  /**
573
1133
  * Downloads a version of the runtime.
574
- * @param { RuntimeDownloadOptions } options - Download options.
575
- * @param {Function} [progressListener] - called as the runtime is downloaded with progress information.
576
- * @return {Promise.<void>}
577
- * @tutorial System.downloadRuntime
1134
+ * @param options - Download options.
1135
+ * @param progressListener - called as the runtime is downloaded with progress information.
1136
+ *
1137
+ * @remarks Only supported in an OpenFin Render process.
1138
+ *
1139
+ * @example
1140
+ * ```js
1141
+ * var downloadOptions = {
1142
+ * //Specific version number required, if given a release channel the call will produce an error.
1143
+ * version: '9.61.30.1'
1144
+ * };
1145
+ *
1146
+ * function onProgress(progress) {
1147
+ * console.log(`${Math.floor((progress.downloadedBytes / progress.totalBytes) * 100)}%`);
1148
+ * }
1149
+ *
1150
+ * fin.System.downloadRuntime(downloadOptions, onProgress).then(() => {
1151
+ * console.log('Download complete');
1152
+ * }).catch(err => {
1153
+ * console.log(`Download Failed, we could retry: ${err.message}`);
1154
+ * console.log(err);
1155
+ * });
1156
+ * ```
578
1157
  */
579
1158
  downloadRuntime(options, progressListener) {
580
1159
  const callsites = transport_errors_1.RuntimeError.getCallSite();
@@ -627,35 +1206,62 @@ class System extends base_1.EmitterBase {
627
1206
  }
628
1207
  /**
629
1208
  * Download preload scripts from given URLs
630
- * @param {DownloadPreloadOption[]} scripts - URLs of preload scripts. See tutorial for more details.
631
- * @return {Promise.Array<DownloadPreloadInfo>}
632
- * @tutorial System.downloadPreloadScripts
1209
+ * @param scripts - URLs of preload scripts. See tutorial for more details.
1210
+ *
1211
+ * @example
1212
+ * ```js
1213
+ * const scripts = [
1214
+ * { url: 'http://.../preload.js' },
1215
+ * { url: 'http://.../preload2.js' }
1216
+ * ];
1217
+ *
1218
+ * fin.System.downloadPreloadScripts(scripts).then(results => {
1219
+ * results.forEach(({url, success, error}) => {
1220
+ * console.log(`URL: ${url}`);
1221
+ * console.log(`Success: ${success}`);
1222
+ * if (error) {
1223
+ * console.log(`Error: ${error}`);
1224
+ * }
1225
+ * });
1226
+ * });
1227
+ * ```
633
1228
  */
634
1229
  downloadPreloadScripts(scripts) {
635
1230
  return this.wire.sendAction('download-preload-scripts', { scripts }).then(({ payload }) => payload.data);
636
1231
  }
637
1232
  /**
638
1233
  * Retrieves an array of data (name, ids, bounds) for all application windows.
639
- * @return {Promise.Array.<Identity>}
640
- * @tutorial System.getAllExternalApplications
1234
+ *
1235
+ * @example
1236
+ * ```js
1237
+ * fin.System.getAllExternalApplications()
1238
+ * .then(externalApps => console.log('Total external apps: ' + externalApps.length))
1239
+ * .catch(err => console.log(err));
1240
+ * ```
641
1241
  */
642
1242
  getAllExternalApplications() {
643
1243
  return this.wire.sendAction('get-all-external-applications').then(({ payload }) => payload.data);
644
1244
  }
645
1245
  /**
646
1246
  * Retrieves app asset information.
647
- * @param { AppAssetRequest } options
648
- * @return {Promise.<AppAssetInfo>}
649
- * @tutorial System.getAppAssetInfo
1247
+ * @param options
1248
+ *
1249
+ * @example
1250
+ * ```js
1251
+ * fin.System.getAppAssetInfo({alias:'procexp'}).then(assetInfo => console.log(assetInfo)).catch(err => console.log(err));
1252
+ * ```
650
1253
  */
651
1254
  getAppAssetInfo(options) {
652
1255
  return this.wire.sendAction('get-app-asset-info', options).then(({ payload }) => payload.data);
653
1256
  }
654
1257
  /**
655
1258
  * Get additional info of cookies.
656
- * @param { CookieOption } options - See tutorial for more details.
657
- * @return {Promise.Array.<CookieInfo>}
658
- * @tutorial System.getCookies
1259
+ * @param options - See tutorial for more details.
1260
+ *
1261
+ * @example
1262
+ * ```js
1263
+ * fin.System.getCookies({name: 'myCookie'}).then(cookies => console.log(cookies)).catch(err => console.log(err));
1264
+ * ```
659
1265
  */
660
1266
  getCookies(options) {
661
1267
  const url = this.wire.environment.getUrl();
@@ -664,18 +1270,24 @@ class System extends base_1.EmitterBase {
664
1270
  }
665
1271
  /**
666
1272
  * Set the minimum log level above which logs will be written to the OpenFin log
667
- * @param { LogLevel } The minimum level (inclusive) above which all calls to log will be written
668
- * @return {Promise.<void>}
669
- * @tutorial System.setMinLogLevel
1273
+ * @param The minimum level (inclusive) above which all calls to log will be written
1274
+ *
1275
+ * @example
1276
+ * ```js
1277
+ * fin.System.setMinLogLevel("verbose").then(() => console.log("log level is set to verbose")).catch(err => console.log(err));
1278
+ * ```
670
1279
  */
671
1280
  setMinLogLevel(level) {
672
1281
  return this.wire.sendAction('set-min-log-level', { level }).then(() => undefined);
673
1282
  }
674
1283
  /**
675
1284
  * Retrieves the UUID of the computer on which the runtime is installed
676
- * @param { string } uuid The uuid of the running application
677
- * @return {Promise.<ApplicationType>}
678
- * @tutorial System.resolveUuid
1285
+ * @param uuid The uuid of the running application
1286
+ *
1287
+ * @example
1288
+ * ```js
1289
+ * fin.System.resolveUuid('OpenfinPOC').then(entity => console.log(entity)).catch(err => console.log(err));
1290
+ * ```
679
1291
  */
680
1292
  resolveUuid(uuid) {
681
1293
  return this.wire
@@ -686,9 +1298,9 @@ class System extends base_1.EmitterBase {
686
1298
  }
687
1299
  /**
688
1300
  * Retrieves an array of data for all external applications
689
- * @param { Identity } requestingIdentity This object is described in the Identity typedef
690
- * @param { any } data Any data type to pass to the method
691
- * @return {Promise.<any>}
1301
+ * @param requestingIdentity This object is described in the Identity typedef
1302
+ * @param data Any data type to pass to the method
1303
+ *
692
1304
  * @ignore
693
1305
  */
694
1306
  executeOnRemote(requestingIdentity, data) {
@@ -696,14 +1308,96 @@ class System extends base_1.EmitterBase {
696
1308
  return this.wire.ferryAction(data);
697
1309
  }
698
1310
  /**
699
- * Reads the specifed value from the registry.<br>
700
- * Note: This method is restricted by default and must be enabled via
701
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
702
- * @param { string } rootKey - The registry root key.
703
- * @param { string } subkey - The registry key.
704
- * @param { string } value - The registry value name.
705
- * @return {Promise.<RegistryInfo>}
706
- * @tutorial System.readRegistryValue
1311
+ * Reads the specifed value from the registry.
1312
+ * @remarks This method is restricted by default and must be enabled via
1313
+ * [API security settings](https://developers.openfin.co/docs/api-security).
1314
+ * @param rootKey - The registry root key.
1315
+ * @param subkey - The registry key.
1316
+ * @param value - The registry value name.
1317
+ *
1318
+ * @example
1319
+ * ```js
1320
+ * fin.System.readRegistryValue("HKEY_LOCAL_MACHINE", "HARDWARE\\DESCRIPTION\\System", "BootArchitecture").then(val => console.log(val)).catch(err => console.log(err));
1321
+ * ```
1322
+ *
1323
+ * See {@link https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx here} for Window's error code definitions.
1324
+ *
1325
+ * Example payloads of different registry types:
1326
+ *
1327
+ * See list of types {@link https://msdn.microsoft.com/en-us/library/windows/desktop/ms724884(v=vs.85).aspx here}.
1328
+ *
1329
+ * ```js
1330
+ * // REG_DWORD
1331
+ * {
1332
+ * data: 1,
1333
+ * rootKey: "HKEY_LOCAL_MACHINE",
1334
+ * subkey: "Foo\Bar",
1335
+ * type: "REG_DWORD",
1336
+ * value: "Baz"
1337
+ * }
1338
+ *
1339
+ * // REG_QWORD
1340
+ * {
1341
+ * data: 13108146671334112,
1342
+ * rootKey: "HKEY_LOCAL_MACHINE",
1343
+ * subkey: "Foo\Bar",
1344
+ * type: "REG_QWORD",
1345
+ * value: "Baz"
1346
+ * }
1347
+ *
1348
+ * // REG_SZ
1349
+ * {
1350
+ * data: "FooBarBaz",
1351
+ * rootKey: "HKEY_LOCAL_MACHINE",
1352
+ * subkey: "Foo\Bar",
1353
+ * type: "REG_SZ",
1354
+ * value: "Baz"
1355
+ * }
1356
+ *
1357
+ * // REG_EXPAND_SZ
1358
+ * {
1359
+ * data: "C:\User\JohnDoe\AppData\Local",
1360
+ * rootKey: "HKEY_CURRENT_USER",
1361
+ * subkey: "Foo\Bar",
1362
+ * type: "REG_EXPAND_SZ",
1363
+ * value: "Baz"
1364
+ * }
1365
+ *
1366
+ * // REG_MULTI_SZ
1367
+ * {
1368
+ * data: [
1369
+ * "Foo",
1370
+ * "Bar",
1371
+ * "Baz"
1372
+ * ],
1373
+ * rootKey: "HKEY_CURRENT_USER",
1374
+ * subkey: "Foo\Bar",
1375
+ * type: "REG_MULTI_SZ",
1376
+ * value: "Baz"
1377
+ * }
1378
+ *
1379
+ * // REG_BINARY
1380
+ * {
1381
+ * data: {
1382
+ * data: [
1383
+ * 255,
1384
+ * 255,
1385
+ * 0,
1386
+ * 43,
1387
+ * 55,
1388
+ * 0,
1389
+ * 0,
1390
+ * 255,
1391
+ * 255
1392
+ * ],
1393
+ * type: "Buffer"
1394
+ * },
1395
+ * rootKey: "HKEY_CURRENT_USER",
1396
+ * subkey: "Foo\Bar",
1397
+ * type: "REG_BINARY",
1398
+ * value: "Baz"
1399
+ * }
1400
+ * ```
707
1401
  */
708
1402
  readRegistryValue(rootKey, subkey, value) {
709
1403
  return this.wire
@@ -717,9 +1411,18 @@ class System extends base_1.EmitterBase {
717
1411
  /**
718
1412
  * This function call will register a unique id and produce a token.
719
1413
  * The token can be used to broker an external connection.
720
- * @param { string } uuid - A UUID for the remote connection.
721
- * @return {Promise.<ExternalConnection>}
722
- * @tutorial System.registerExternalConnection
1414
+ * @param uuid - A UUID for the remote connection.
1415
+ *
1416
+ * @example
1417
+ * ```js
1418
+ * fin.System.registerExternalConnection("remote-connection-uuid").then(conn => console.log(conn)).catch(err => console.log(err));
1419
+ *
1420
+ *
1421
+ * // object comes back with
1422
+ * // token: "0489EAC5-6404-4F0D-993B-92BB8EAB445D", // this will be unique each time
1423
+ * // uuid: "remote-connection-uuid"
1424
+ *
1425
+ * ```
723
1426
  */
724
1427
  registerExternalConnection(uuid) {
725
1428
  return this.wire.sendAction('register-external-connection', { uuid }).then(({ payload }) => payload.data);
@@ -727,10 +1430,16 @@ class System extends base_1.EmitterBase {
727
1430
  /**
728
1431
  * Returns the json blob found in the [desktop owner settings](https://openfin.co/documentation/desktop-owner-settings/)
729
1432
  * for the specified service.
730
- * More information about desktop services can be found [here](https://developers.openfin.co/docs/desktop-services).
731
- * @param { ServiceIdentifier } serviceIdentifier An object containing a name key that identifies the service.
732
- * @return {Promise.<ServiceConfiguration>}
733
- * @tutorial System.getServiceConfiguration
1433
+ * @param serviceIdentifier An object containing a name key that identifies the service.
1434
+ *
1435
+ * @remarks More information about desktop services can be found [here](https://developers.openfin.co/docs/desktop-services).
1436
+ * This call will reject if the desktop owner settings file is not present, not correctly formatted, or if the service requested is not configured or configured incorrectly.
1437
+ *
1438
+ * @example
1439
+ * ```js
1440
+ * // Here we are using the [layouts](https://github.com/HadoukenIO/layouts-service) service.
1441
+ * fin.System.getServiceConfiguration({name:'layouts'}).then(console.log).catch(console.error);
1442
+ * ```
734
1443
  */
735
1444
  async getServiceConfiguration(serviceIdentifier) {
736
1445
  if (typeof serviceIdentifier.name !== 'string') {
@@ -747,10 +1456,20 @@ class System extends base_1.EmitterBase {
747
1456
  }
748
1457
  /**
749
1458
  * Registers a system shutdown handler so user can do some cleanup before system is shutting down.
750
- * Note: Once system shutdown starts, you are unable to cancel it.
751
- * @param { SystemShutdownHandler } handler system shutdown handler
752
- * @return {Promise.<void>}
753
- * @tutorial System.registerShutdownHandler
1459
+ * @remarks Once system shutdown starts, you are unable to cancel it.
1460
+ * @param handler system shutdown handler
1461
+ *
1462
+ * @example
1463
+ * ```js
1464
+ * fin.System.registerShutdownHandler((shutdownEvent) => {
1465
+ * // save state or cleanup
1466
+ * console.log('do some cleanup before shutdown');
1467
+ * // Notify app is ready for termination.
1468
+ * shutdownEvent.proceed();
1469
+ * })
1470
+ * .then(() => console.log('Shutdown handler registered!'))
1471
+ * .catch(err => console.log(err));
1472
+ * ```
754
1473
  * @experimental
755
1474
  */
756
1475
  async registerShutdownHandler(handler) {
@@ -775,19 +1494,100 @@ class System extends base_1.EmitterBase {
775
1494
  }
776
1495
  /**
777
1496
  * Signals the RVM to perform a health check and returns the results as json.
778
- * @return {Promise.<string[]>}
779
- * @tutorial System.runRvmHealthCheck
1497
+ *
1498
+ * @remarks Requires RVM 5.5+
1499
+ *
1500
+ * @example
1501
+ * ```js
1502
+ * try {
1503
+ * const results = await fin.System.runRvmHealthCheck();
1504
+ * console.log(results);
1505
+ * } catch(e) {
1506
+ * console.error(e);
1507
+ * }
1508
+ * ```
780
1509
  */
781
1510
  runRvmHealthCheck() {
782
1511
  return this.wire.sendAction('run-rvm-health-check').then(({ payload }) => payload.data);
783
1512
  }
784
1513
  /**
785
1514
  * Launch application using a manifest URL/path. It differs from Application.startFromManifest in that this API can accept a manifest using the fin protocol.
786
- * @param {string} manifestUrl - The manifest's URL or path.
787
- * @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
788
- * @return {Promise.<Manifest>}
1515
+ * @param manifestUrl - The manifest's URL or path.
1516
+ * @param opts - Parameters that the RVM will use.
1517
+ *
789
1518
  * @experimental
790
- * @tutorial System.launchManifest
1519
+ * @remarks Supports protocols http/s and fin/s, and also a local path.
1520
+ *
1521
+ * Note: This API is Windows only.
1522
+ *
1523
+ * @example
1524
+ *
1525
+ * This API can handle most manifest types. Some examples below.
1526
+ *
1527
+ * Traditional:
1528
+ * ```js
1529
+ * const manifest = await fin.System.launchManifest(
1530
+ * 'https://demoappdirectory.openf.in/desktop/config/apps/OpenFin/HelloOpenFin/app.json');
1531
+ * console.log(manifest);
1532
+ * ```
1533
+ *
1534
+ * Platform:
1535
+ * ```js
1536
+ * const manifest = await fin.System.launchManifest('https://openfin.github.io/platform-api-project-seed/public.json');
1537
+ * console.log(manifest);
1538
+ * ```
1539
+ *
1540
+ * Launching traditional manifest into a platform:
1541
+ * ```js
1542
+ * const manifest = await fin.System.launchManifest(
1543
+ * 'https://openfin.github.io/platform-api-project-seed/public.json?\
1544
+ * $$appManifestUrl=https://demoappdirectory.openf.in/desktop/config/\
1545
+ * apps/OpenFin/HelloOpenFin/app.json');
1546
+ * console.log(manifest);
1547
+ * ```
1548
+ *
1549
+ * Launching with RVM options:
1550
+ * ```js
1551
+ * const manifest = await fin.System.launchManifest('https://openfin.github.io/platform-api-project-seed/public.json',
1552
+ * { noUi: true, userAppConfigArgs: { abc: '123', xyz: '789' } });
1553
+ * console.log(manifest);
1554
+ * ```
1555
+ *
1556
+ * Local Path:
1557
+ * ```js
1558
+ * const manifest = await fin.System.launchManifest('file://c:\\path\\to\\manifest\\file.json');
1559
+ * console.log(manifest);
1560
+ * ```
1561
+ *
1562
+ * Launching with RVM 'subscribe' option:
1563
+ *
1564
+ * This option allows users to subscribe to app version resolver events when
1565
+ * calling launchManifest with fallbackManifests specified.
1566
+ *
1567
+ * ```js
1568
+ * fin.System.launchManifest('fins://system-apps/notifications/app.json', { subscribe: (launch) => {
1569
+ * launch.on('app-version-progress', (progress) => {
1570
+ * console.log("Trying manifest " + progress.manifest)
1571
+ * });
1572
+ *
1573
+ * launch.on('runtime-status', (status) => {
1574
+ * console.log("Runtime status: " + JSON.stringify(status));
1575
+ * });
1576
+ *
1577
+ * // RVM has successfully found the target runtime version
1578
+ * launch.on('app-version-complete', (complete) => {
1579
+ * console.log("Parent app " + complete.srcManifest + " resolved to " + complete.manifest);
1580
+ * launch.removeAllListeners();
1581
+ * });
1582
+ *
1583
+ * // RVM failed to find an available runtime version
1584
+ * launch.on('app-version-error', (error) => {
1585
+ * console.log("Failed to resolve " + error.srcManifest + " from the fallbackManifests");
1586
+ * launch.removeAllListeners();
1587
+ * });
1588
+ * }
1589
+ * });
1590
+ * ```
791
1591
  * @static
792
1592
  */
793
1593
  async launchManifest(manifestUrl, opts = {}) {
@@ -847,9 +1647,19 @@ class System extends base_1.EmitterBase {
847
1647
  }
848
1648
  /**
849
1649
  * Query permission of a secured api in current context.
850
- * @param {string} apiName - The full name of a secured API.
851
- * @return {Promise.<QueryPermissionResult>}
852
- * @tutorial System.queryPermissionForCurrentContext
1650
+ * @param apiName - The full name of a secured API.
1651
+ *
1652
+ * @example
1653
+ * ```js
1654
+ * fin.System.queryPermissionForCurrentContext('System.launchExternalProcess').then(result => console.log(result)).catch(err => console.log(err));
1655
+ *
1656
+ * //This response has the following shape:
1657
+ * {
1658
+ * permission: 'System.launchExternalProcess', // api full name
1659
+ * state: 'granted', // state of permission
1660
+ * granted: true
1661
+ * }
1662
+ * ```
853
1663
  */
854
1664
  async queryPermissionForCurrentContext(apiName) {
855
1665
  const identity = { uuid: this.wire.me.uuid, name: this.wire.me.name };
@@ -866,17 +1676,48 @@ class System extends base_1.EmitterBase {
866
1676
  }
867
1677
  /**
868
1678
  * (Internal) Register the usage of a component with a platform
869
- * @param {OpenFin.RegisterUsageData} options - Object with data and type
870
- * @return {Promise.<void>}
871
- * @tutorial System.registerUsage
1679
+ * @param options - Object with data and type
1680
+ *
1681
+ * @example
1682
+ * ```js
1683
+ * async function registerUsage() {
1684
+ * const app = await fin.System.getCurrent();
1685
+ * return await fin.System.registerUsage({
1686
+ * type: 'workspace-licensing',
1687
+ * // example values for the following data object
1688
+ * data: {
1689
+ * apiVersion: '1.0',
1690
+ * componentName: 'home',
1691
+ * componentVersion: '1.0',
1692
+ * allowed: true,
1693
+ * rejectionCode: ''
1694
+ * }
1695
+ * });
1696
+ * }
1697
+ *
1698
+ * registerUsage().then(() => console.log('Successfully registered component application')).catch(err => console.log(err));
1699
+ * ```
872
1700
  */
873
1701
  async registerUsage({ data, type }) {
874
1702
  await this.wire.sendAction('register-usage', { data, type });
875
1703
  }
876
1704
  /**
877
1705
  * Returns an array with all printers of the caller and not all the printers on the desktop.
878
- * @return { Promise.Array.<PrinterInfo> }
879
- * @tutorial System.getPrinters
1706
+ *
1707
+ * @example
1708
+ * ```js
1709
+ * fin.System.getPrinters()
1710
+ * .then((printers) => {
1711
+ * printers.forEach((printer) => {
1712
+ * if (printer.isDefault) {
1713
+ * console.log(printer);
1714
+ * }
1715
+ * });
1716
+ * })
1717
+ * .catch((err) => {
1718
+ * console.log(err);
1719
+ * });
1720
+ * ```
880
1721
  */
881
1722
  async getPrinters() {
882
1723
  const { payload } = await this.wire.sendAction('system-get-printers');
@@ -884,12 +1725,127 @@ class System extends base_1.EmitterBase {
884
1725
  }
885
1726
  /**
886
1727
  * Updates Process Logging values: periodic interval and outlier detection entries and interval.
887
- * @param {ProcessLoggingOptions} options Process Logging updatable options.
888
- * @return { Promise<void> }
889
- * @tutorial System.updateProcessLoggingOptions
1728
+ * @param options Process Logging updatable options.
1729
+ *
1730
+ * @remarks When enabling verbose mode, additional process information is logged to the debug.log:
1731
+ *
1732
+ * 1. Periodically process usage (memory, cpu, etc) will be logged for each PID along with the windows, views and
1733
+ * iframes that belong to them. The default is every 30 seconds. Updatable by passing the interval option.
1734
+ * 2. When Windows and Views are created or navigated the PID they belong to and their options will be logged.
1735
+ * 3. When Windows and Views are destroyed their last known process usage will be logged.
1736
+ * 4. Whenever an outlier memory usage is detected it will be logged. By default, on an interval of 5 seconds we will
1737
+ * collect process usage for all PIDs and when 144 such entries are collected, we will start analyzing the data for any
1738
+ * possible outliers in the following entries. The interval and maximum number of entries stored in the running buffer
1739
+ * can be updatable by passing the outlierDetection.interval and outlierDetection.entries options.
1740
+ *
1741
+ * @example
1742
+ *
1743
+ * ```js
1744
+ * await fin.System.updateProcessLoggingOptions({
1745
+ * interval: 10,
1746
+ * outlierDetection: {
1747
+ * interval: 15,
1748
+ * entries: 200
1749
+ * }
1750
+ * });
1751
+ * ```
890
1752
  */
891
1753
  async updateProcessLoggingOptions(options) {
892
1754
  await this.wire.sendAction('system-update-process-logging-options', { options });
893
1755
  }
1756
+ /**
1757
+ * Returns domain settings for the current application.
1758
+ * Initial settings are configured with the defaultDomainSettings application option via manifest.
1759
+ * Domain settings can be overwritten during runtime with System.setDomainSettings.
1760
+ * @example
1761
+ * ```js
1762
+ * const domainSettings = await fin.System.getDomainSettings();
1763
+ * // {
1764
+ * // "rules": [
1765
+ * // {
1766
+ * // "match": [
1767
+ * // "https://openfin.co"
1768
+ * // ],
1769
+ * // "options": {
1770
+ * // "downloadSettings": {
1771
+ * // "rules": [
1772
+ * // {
1773
+ * // "match": [
1774
+ * // "<all_urls>"
1775
+ * // ],
1776
+ * // "behavior": "prompt"
1777
+ * // }
1778
+ * // ]
1779
+ * // }
1780
+ * // }
1781
+ * // }
1782
+ * // ]
1783
+ * // }
1784
+ * ```
1785
+ */
1786
+ async getDomainSettings() {
1787
+ const { payload: { data } } = await this.wire.sendAction('get-domain-settings', this.identity);
1788
+ return data;
1789
+ }
1790
+ /**
1791
+ * Sets the domain settings for the current application.
1792
+ * @param domainSettings - domain settings object
1793
+ * @example
1794
+ * ```js
1795
+ * const domainSettings = await fin.System.getDomainSettings();
1796
+ * // {
1797
+ * // "rules": [
1798
+ * // {
1799
+ * // "match": [
1800
+ * // "https://openfin.co"
1801
+ * // ],
1802
+ * // "options": {
1803
+ * // "downloadSettings": {
1804
+ * // "rules": [
1805
+ * // {
1806
+ * // "match": [
1807
+ * // "<all_urls>"
1808
+ * // ],
1809
+ * // "behavior": "prompt"
1810
+ * // }
1811
+ * // ]
1812
+ * // }
1813
+ * // }
1814
+ * // }
1815
+ * // ]
1816
+ * // }
1817
+ *
1818
+ * // Valid rule behaviors are 'prompt' and 'no-prompt'
1819
+ * domainSettings.rules[0].options.downloadSettings.rules[0].behavior = 'no-prompt';
1820
+ *
1821
+ * await fin.System.setDomainSettings(domainSettings);
1822
+ *
1823
+ * const newDomainSettings = await fin.System.getDomainSettings();
1824
+ * // {
1825
+ * // "rules": [
1826
+ * // {
1827
+ * // "match": [
1828
+ * // "https://openfin.co"
1829
+ * // ],
1830
+ * // "options": {
1831
+ * // "downloadSettings": {
1832
+ * // "rules": [
1833
+ * // {
1834
+ * // "match": [
1835
+ * // "<all_urls>"
1836
+ * // ],
1837
+ * // "behavior": "no-prompt"
1838
+ * // }
1839
+ * // ]
1840
+ * // }
1841
+ * // }
1842
+ * // }
1843
+ * // ]
1844
+ * // }
1845
+ * ```
1846
+ */
1847
+ async setDomainSettings(domainSettings) {
1848
+ await this.wire.sendAction('set-domain-settings', { domainSettings, ...this.identity });
1849
+ }
894
1850
  }
895
1851
  exports.default = System;