@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
@@ -8,8 +8,8 @@ type LayoutModule = OpenFin.Fin['Platform']['Layout'];
8
8
  *
9
9
  * Enables taking snapshots of itself and applyi
10
10
  * ng them to restore a previous configuration
11
- * as well as listen to <a href="tutorial-Platform.EventEmitter.html">platform events</a>.
12
- * @namespace
11
+ * as well as listen to {@link OpenFin.PlatformEvents platform events}.
12
+ *
13
13
  */
14
14
  export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
15
15
  #private;
@@ -17,52 +17,293 @@ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
17
17
  private _channel;
18
18
  Application: OpenFin.Application;
19
19
  identity: OpenFin.ApplicationIdentity;
20
+ /**
21
+ * @internal
22
+ */
20
23
  constructor(identity: OpenFin.ApplicationIdentity, channel: Channel);
21
24
  getClient: (identity?: OpenFin.ApplicationIdentity) => Promise<ChannelClient>;
22
25
  /**
23
26
  * Creates a new view and attaches it to a specified target window.
24
- * @param { View~options } viewOptions View creation options
25
- * @param { Identity } [target] The window to which the new view is to be attached. If no target, create a view in a new window.
26
- * @param { Identity } [targetView] If provided, the new view will be added to the same tabstrip as targetView.
27
- * @return { Promise<View> }
28
- * @tutorial Platform.createView
27
+ * @param viewOptions View creation options
28
+ * @param target The window to which the new view is to be attached. If no target, create a view in a new window.
29
+ * @param targetView If provided, the new view will be added to the same tabstrip as targetView.
30
+ *
31
+ * @remarks If the view already exists, will reparent the view to the new target. You do not need to set a name for a View.
32
+ * Views that are not passed a name get a randomly generated one.
33
+ *
34
+ * @example
35
+ * ```js
36
+ * let windowIdentity;
37
+ * if (fin.me.isWindow) {
38
+ * windowIdentity = fin.me.identity;
39
+ * } else if (fin.me.isView) {
40
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
41
+ * } else {
42
+ * throw new Error('Not running in a platform View or Window');
43
+ * }
44
+ *
45
+ * const platform = fin.Platform.getCurrentSync();
46
+ *
47
+ * platform.createView({
48
+ * name: 'test_view',
49
+ * url: 'https://developers.openfin.co/docs/platform-api'
50
+ * }, windowIdentity).then(console.log);
51
+ * ```
52
+ *
53
+ * Reparenting a view:
54
+ * ```js
55
+ * let windowIdentity;
56
+ * if (fin.me.isWindow) {
57
+ * windowIdentity = fin.me.identity;
58
+ * } else if (fin.me.isView) {
59
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
60
+ * } else {
61
+ * throw new Error('Not running in a platform View or Window');
62
+ * }
63
+ *
64
+ * let platform = fin.Platform.getCurrentSync();
65
+ * let viewOptions = {
66
+ * name: 'example_view',
67
+ * url: 'https://example.com'
68
+ * };
69
+ * // a new view will now show in the current window
70
+ * await platform.createView(viewOptions, windowIdentity);
71
+ *
72
+ * const view = fin.View.wrapSync({ uuid: windowIdentity.uuid, name: 'yahoo_view' });
73
+ * // reparent `example_view` when a view in the new window is shown
74
+ * view.on('shown', async () => {
75
+ * let viewIdentity = { uuid: windowIdentity.uuid, name: 'example_view'};
76
+ * let target = {uuid: windowIdentity.uuid, name: 'test_win'};
77
+ * platform.createView(viewOptions, target);
78
+ * });
79
+ *
80
+ * // create a new window
81
+ * await platform.createWindow({
82
+ * name: "test_win",
83
+ * layout: {
84
+ * content: [
85
+ * {
86
+ * type: 'stack',
87
+ * content: [
88
+ * {
89
+ * type: 'component',
90
+ * componentName: 'view',
91
+ * componentState: {
92
+ * name: 'yahoo_view',
93
+ * url: 'https://yahoo.com'
94
+ * }
95
+ * }
96
+ * ]
97
+ * }
98
+ * ]
99
+ * }
100
+ * }).then(console.log);
101
+ * ```
29
102
  */
30
103
  createView(viewOptions: OpenFin.PlatformViewCreationOptions, target?: OpenFin.CreateViewTarget, targetView?: OpenFin.Identity): Promise<View>;
31
104
  /**
32
105
  * Creates a new Window.
33
- * @param { Window~options } options Window creation options
34
- * @return { Promise<_Window> }
35
- * @tutorial Platform.createWindow
106
+ * @param options Window creation options
107
+ *
108
+ * @remarks There are two Window types at your disposal while using OpenFin Platforms - Default Window and Custom Window.
109
+ *
110
+ * The Default Window uses the standard OpenFin Window UI. It contains the standard close, maximize and minimize buttons,
111
+ * and will automatically render the Window's layout if one is specified.
112
+ *
113
+ * For deeper customization, you can bring your own Window code into a Platform. This is called a Custom Window.
114
+ *
115
+ * @example
116
+ *
117
+ *
118
+ * The example below will create a Default Window which uses OpenFin default Window UI.<br>
119
+ * The Window contains two Views in a stack Layout:
120
+ *
121
+ * ```js
122
+ * const platform = fin.Platform.getCurrentSync();
123
+ * platform.createWindow({
124
+ * layout: {
125
+ * content: [
126
+ * {
127
+ * type: 'stack',
128
+ * content: [
129
+ * {
130
+ * type: 'component',
131
+ * componentName: 'view',
132
+ * componentState: {
133
+ * name: 'test_view_1',
134
+ * url: 'https://cdn.openfin.co/docs/javascript/canary/Platform.html'
135
+ * }
136
+ * },
137
+ * {
138
+ * type: 'component',
139
+ * componentName: 'view',
140
+ * componentState: {
141
+ * name: 'test_view_2',
142
+ * url: 'https://cdn.openfin.co/docs/javascript/canary/Platform.html'
143
+ * }
144
+ * }
145
+ * ]
146
+ * }
147
+ * ]
148
+ * }
149
+ * }).then(console.log);
150
+ * ```
151
+ * The Default Window's design can be customized by specifying the `stylesheetUrl` property in the manifest:
152
+ *
153
+ * ```json
154
+ * {
155
+ * platform: {
156
+ * defaultWindowOptions: {
157
+ * stylesheetUrl: 'some-url.css',
158
+ * ...
159
+ * }
160
+ * }
161
+ * }
162
+ * ```
163
+ * For a list of common Layout CSS classes you can override in your custom stylesheet, see <a href="tutorial-layoutStyles.html">Useful Layout CSS Classes</a>
164
+ **
165
+ * To specify a Platform Custom Window, provide a `url` property when creating a Window.
166
+ * If you intend to render a Layout in your Custom Window, you must also specify an `HTMLElement` that the Layout will inject into and set its `id` property to `"layout-container"`.
167
+ *
168
+ * The example below will create a Platform Custom Window:
169
+ *
170
+ * ```js
171
+ * // in an OpenFin app:
172
+ * const platform = fin.Platform.getCurrentSync();
173
+ * const windowConfig =
174
+ * {
175
+ * url: "https://www.my-domain.com/my-custom-window.html", // here we point to where the Custom Frame is hosted.
176
+ * layout: {
177
+ * content: [
178
+ * {
179
+ * type: "stack",
180
+ * content: [
181
+ * {
182
+ * type: "component",
183
+ * componentName: "view",
184
+ * componentState: {
185
+ * name: "app #1",
186
+ * url: "https://cdn.openfin.co/docs/javascript/canary/Platform.html"
187
+ * }
188
+ * },
189
+ * {
190
+ * type: "component",
191
+ * componentName: "view",
192
+ * componentState: {
193
+ * name: "app #2",
194
+ * url: "https://cdn.openfin.co/docs/javascript/canary/Platform.html"
195
+ * }
196
+ * }
197
+ * ]
198
+ * }
199
+ * ]
200
+ * }
201
+ * };
202
+ * platform.createWindow(windowConfig);
203
+ * ```
204
+ *
205
+ * Here's an example of a minimalist Custom Platform Window implementation:
206
+ * ```html
207
+ * <html>
208
+ * <head>
209
+ * <meta charset="utf-8">
210
+ * <meta name="viewport" content="width=device-width, initial-scale=1">
211
+ * <link rel="stylesheet" type="text/css" href="./styles.css">
212
+ * </head>
213
+ * <body>
214
+ * <div id="of-frame-main">
215
+ * <div id="title-bar">
216
+ * <div class="title-bar-draggable">
217
+ * <div id="title"> This is a custom frame! </div>
218
+ * </div>
219
+ * <div id="buttons-wrapper">
220
+ * <div class="button" id="minimize-button"></div>
221
+ * <div class="button" id="expand-button"></div>
222
+ * <div class="button" id="close-button"></div>
223
+ * </div>
224
+ * </div>
225
+ * <div id="layout-container"></div> <!-- OpenFin layout would be injected here -->
226
+ * <script src="./custom-frame.js"></script>
227
+ * </div>
228
+ * </body>
229
+ * </html>
230
+ * ```
231
+ * Your Custom Window can use in-domain resources for further customization (such as CSS, scripts, etc.).<br>
232
+ * For a list of common Layout CSS classes you can override in your stylesheet, see <a href="tutorial-layoutStyles.html">Useful Layout CSS Classes</a>
233
+ *
234
+ * The example above will require the `body` element to have `height: 100%;` set in order to render the layout correctly.
36
235
  */
37
236
  createWindow(options: OpenFin.PlatformWindowCreationOptions): Promise<OpenFin.Window & OpenFin.Identity>;
38
237
  /**
39
238
  * Closes current platform, all its windows, and their views.
40
- * @return { Promise<void> }
41
- * @tutorial Platform.quit
239
+ *
240
+ * @example
241
+ * ```js
242
+ * const platform = await fin.Platform.getCurrent();
243
+ * platform.quit();
244
+ * // All windows/views in current layout platform will close and platform will shut down
245
+ * ```
42
246
  */
43
247
  quit(): Promise<void>;
44
248
  /**
45
249
  * Closes a specified view in a target window.
46
- * @param { Identity } viewIdentity View identity
47
- * @return { Promise<void> }
48
- * @tutorial Platform.closeView
250
+ * @param viewIdentity View identity
251
+ *
252
+ * @example
253
+ * ```js
254
+ * let windowIdentity;
255
+ * if (fin.me.isWindow) {
256
+ * windowIdentity = fin.me.identity;
257
+ * } else if (fin.me.isView) {
258
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
259
+ * } else {
260
+ * throw new Error('Not running in a platform View or Window');
261
+ * }
262
+ *
263
+ * const viewOptions = {
264
+ * name: 'test_view',
265
+ * url: 'https://example.com'
266
+ * };
267
+ *
268
+ * function sleep(ms) {
269
+ * return new Promise(resolve => setTimeout(resolve, ms));
270
+ * }
271
+ *
272
+ * const platform = await fin.Platform.getCurrent();
273
+ *
274
+ * await platform.createView(viewOptions, windowIdentity);
275
+ * // a new view will now show in the current window
276
+ *
277
+ * await sleep(5000);
278
+ *
279
+ * const viewIdentity = { uuid: windowIdentity.uuid, name: 'test_view'};
280
+ * platform.closeView(viewIdentity);
281
+ * // the view will now close
282
+ * ```
49
283
  */
50
284
  closeView(viewIdentity: OpenFin.Identity): Promise<void>;
51
285
  /**
52
286
  * ***DEPRECATED - please use Platform.createView.***
53
287
  * Reparents a specified view in a new target window.
54
- * @param { Identity } viewIdentity View identity
55
- * @param { Identity } target new owner window identity
56
- * @return { Promise<View> }
288
+ * @param viewIdentity View identity
289
+ * @param target new owner window identity
290
+ *
57
291
  * @tutorial Platform.createView
58
292
  */
59
293
  reparentView(viewIdentity: OpenFin.Identity, target: OpenFin.Identity): Promise<View>;
60
294
  /**
61
- * Returns a snapshot of the platform in its current state.
295
+ * Returns a snapshot of the platform in its current state. You can pass the returning object to
296
+ * [Platform.applySnapshot]{@link Platform#applySnapshot} to launch it.
297
+ *
298
+ * @remarks The snapshot will include details such as an [ISO format](https://en.wikipedia.org/wiki/ISO_8601)
299
+ * timestamp of when the snapshot was taken, OpenFin runtime version the platform is running on, monitor information
300
+ * and the list of currently running windows.
62
301
  *
63
- * Can be used to restore an application to a previous state.
64
- * @return { Promise<Snapshot> }
65
- * @tutorial Platform.getSnapshot
302
+ * @example
303
+ * ```js
304
+ * const platform = await fin.Platform.getCurrent();
305
+ * const snapshot = await platform.getSnapshot();
306
+ * ```
66
307
  */
67
308
  getSnapshot(): Promise<OpenFin.Snapshot>;
68
309
  /**
@@ -72,11 +313,25 @@ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
72
313
  *
73
314
  * Can be used to restore a view to a previous state.
74
315
  *
75
- * @param { Identity } viewIdentity View identity
76
- * @returns { Promise<ViewState> }
316
+ * @param viewIdentity View identity
317
+ *
77
318
  * @internal
78
319
  * @experimental
79
- * @tutorial Platform.getViewSnapshot
320
+ * @remarks This slice of snapshot state is equivalent to what is stored as `componentState` for views
321
+ * when capturing platform state using [Platform.getSnapshot]{@link Platform#getSnapshot}.
322
+ *
323
+ * @example
324
+ * ```js
325
+ * const platform = await fin.Platform.getCurrent();
326
+ * const url = 'https://google.com';
327
+ * const view = await fin.View.create({ name: 'my-view', target: fin.me.identity, url });
328
+ *
329
+ * await view.navigate(url);
330
+ *
331
+ * const viewState = await platform.getViewSnapshot(view.identity);
332
+ *
333
+ * console.log(viewState);
334
+ * ```
80
335
  */
81
336
  getViewSnapshot(viewIdentity: OpenFin.Identity): Promise<OpenFin.ViewState>;
82
337
  /**
@@ -87,60 +342,308 @@ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
87
342
  *
88
343
  * The function accepts either a snapshot taken using {@link Platform#getSnapshot getSnapshot},
89
344
  * or a url or filepath to a snapshot JSON object.
90
- * @param { Snapshot | string } requestedSnapshot Snapshot to apply, or a url or filepath.
91
- * @param { ApplySnapshotOptions } [options] Optional parameters to specify whether existing windows should be closed.
92
- * @return { Promise<Platform> }
93
- * @tutorial Platform.applySnapshot
345
+ * @param requestedSnapshot Snapshot to apply, or a url or filepath.
346
+ * @param options Optional parameters to specify whether existing windows should be closed.
347
+ *
348
+ * @remarks Will create any windows and views that are not running but are passed in the snapshot object. Any View
349
+ * specified in the snapshot is assigned a randomly generated name to avoid collisions.
350
+ *
351
+ * @example
352
+ * ```js
353
+ * // Get a wrapped layout platform instance
354
+ * const platform = await fin.Platform.getCurrent();
355
+ *
356
+ * const snapshot = {
357
+ * windows: [
358
+ * {
359
+ * layout: {
360
+ * content: [
361
+ * {
362
+ * type: 'stack',
363
+ * content: [
364
+ * {
365
+ * type: 'component',
366
+ * componentName: 'view',
367
+ * componentState: {
368
+ * name: 'component_X',
369
+ * url: 'https://www.openfin.co'
370
+ * }
371
+ * },
372
+ * {
373
+ * type: 'component',
374
+ * componentName: 'view',
375
+ * componentState: {
376
+ * name: 'component_Y',
377
+ * url: 'https://cdn.openfin.co/embed-web/chart.html'
378
+ * }
379
+ * }
380
+ * ]
381
+ * }
382
+ * ]
383
+ * }
384
+ * }
385
+ * ]
386
+ * }
387
+ *
388
+ * platform.applySnapshot(snapshot);
389
+ * ```
390
+ *
391
+ * In place of a snapshot object, `applySnapshot` can take a url or filepath and to retrieve a JSON snapshot.
392
+ *
393
+ * ```js
394
+ * const platform = await fin.Platform.getCurrent();
395
+ * platform.applySnapshot('https://api.jsonbin.io/b/5e6f903ef4331e681fc1231d/1');
396
+ * ```
397
+ *
398
+ * Optionally, `applySnapshot` can close existing windows and restore a Platform to a previously saved state.
399
+ * This is accomplished by providing `{ closeExistingWindows: true }` as an option.
400
+ *
401
+ * ```js
402
+ * // Get a wrapped layout platform instance
403
+ * const platform = await fin.Platform.getCurrent();
404
+ *
405
+ * async function addViewToWindow(winId) {
406
+ * return await platform.createView({
407
+ * name: 'test_view_3',
408
+ * url: 'https://openfin.co'
409
+ * }, winId);
410
+ * }
411
+ *
412
+ * async function createWindowWithTwoViews() {
413
+ * const platform = await fin.Platform.getCurrent();
414
+ *
415
+ * return platform.createWindow({
416
+ * layout: {
417
+ * content: [
418
+ * {
419
+ * type: 'stack',
420
+ * content: [
421
+ * {
422
+ * type: 'component',
423
+ * componentName: 'view',
424
+ * componentState: {
425
+ * name: 'test_view_1',
426
+ * url: 'https://example.com'
427
+ * }
428
+ * },
429
+ * {
430
+ * type: 'component',
431
+ * componentName: 'view',
432
+ * componentState: {
433
+ * name: 'test_view_2',
434
+ * url: 'https://yahoo.com'
435
+ * }
436
+ * }
437
+ * ]
438
+ * }
439
+ * ]
440
+ * }
441
+ * });
442
+ * }
443
+ *
444
+ * const win = await createWindowWithTwoViews();
445
+ * // ... you will now see a new window with two views in it
446
+ *
447
+ * // we take a snapshot of the current state of the app, before changing it
448
+ * const snapshotOfInitialAppState = await platform.getSnapshot();
449
+ *
450
+ * // now let's change the state of the app:
451
+ * await addViewToWindow(win.identity);
452
+ * // ... the window now has three views in it
453
+ *
454
+ * await platform.applySnapshot(snapshotOfInitialAppState, { closeExistingWindows: true });
455
+ * // ... the window will revert to previous state, with just two views
456
+ *
457
+ * ```
94
458
  */
95
459
  applySnapshot(requestedSnapshot: OpenFin.Snapshot | string, options?: OpenFin.ApplySnapshotOptions): Promise<Platform>;
96
460
  /**
97
461
  * Fetches a JSON manifest using the browser process and returns a Javascript object.
98
- * Can be overwritten using {@link Platform#init Platform.init}.
99
- * @param { string } manifestUrl The URL of the manifest to fetch.
100
- * @return { Promise<any> }
101
- * @tutorial Platform.fetchManifest
462
+ * Can be overwritten using {@link Platform.PlatformModule.init Platform.init}.
463
+ * @param manifestUrl The URL of the manifest to fetch.
464
+ *
465
+ * @remarks Can be overwritten using {@link Platform#init Platform.init}.
466
+ *
467
+ * @example
468
+ *
469
+ * ```js
470
+ * const platform = fin.Platform.getCurrentSync();
471
+ * const manifest = await platform.fetchManifest('https://www.path-to-manifest.com/app.json');
472
+ * console.log(manifest);
473
+ * ```
102
474
  */
103
475
  fetchManifest(manifestUrl: string): Promise<any>;
476
+ /**
477
+ * @deprecated (renamed)
478
+ * @ignore
479
+ */
104
480
  launchLegacyManifest: (manifestUrl: string) => Promise<Platform>;
105
481
  /**
106
482
  * Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that
107
483
  * resolves to the wrapped Platform.
108
- * @param {string} manifestUrl - The URL of the manifest that will be launched into the platform. If this app manifest
484
+ * @param manifestUrl - The URL of the manifest that will be launched into the platform. If this app manifest
109
485
  * contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options
110
- * will be launched into the platform. The applicable startup_app options will become {@link View~options View Options}.
111
- * @return {Promise<Platform>}
112
- * @tutorial Platform.launchContentManifest
486
+ * will be launched into the platform. The applicable startup_app options will become {@link OpenFin.ViewCreationOptions View Options}.
487
+ *
488
+ * @remarks If the app manifest contains a snapshot, that will be launched into the platform. If not, the
489
+ * application described in startup_app options will be launched into the platform as a window with a single view.
490
+ * The applicable startup_app options will become View Options.
491
+ *
492
+ * @example
493
+ * ```js
494
+ * try {
495
+ * const platform = fin.Platform.getCurrentSync();
496
+ * await platform.launchContentManifest('http://localhost:5555/app.json');
497
+ * console.log(`content launched successfully into platform`);
498
+ * } catch(e) {
499
+ * console.error(e);
500
+ * }
501
+ * // For a local manifest file:
502
+ * try {
503
+ * const platform = fin.Platform.getCurrentSync();
504
+ * platform.launchContentManifest('file:///C:/somefolder/app.json');
505
+ * console.log(`content launched successfully into platform`);
506
+ * } catch(e) {
507
+ * console.error(e);
508
+ * }
509
+ * ```
113
510
  * @experimental
114
511
  */
115
512
  launchContentManifest(manifestUrl: string): Promise<Platform>;
116
513
  /**
117
514
  * Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots.
118
515
  * It can be retrieved using {@link Platform#getWindowContext getWindowContext}.
119
- * @param {any} context - A field where serializable context data can be stored to be saved in platform snapshots.
120
- * @param {Identity} [target] - A target window or view may optionally be provided. If no target is provided, the update will be applied
516
+ * @param context - A field where serializable context data can be stored to be saved in platform snapshots.
517
+ * @param target - A target window or view may optionally be provided. If no target is provided, the update will be applied
121
518
  * to the current window (if called from a Window) or the current host window (if called from a View).
122
- * @return {Promise<void>}
123
- * @tutorial Platform.setWindowContext
519
+ *
520
+ * @remarks The context data must be serializable. This can only be called from a window or view that has been launched into a
521
+ * platform.
522
+ * This method can be called from the window itself, or from any child view. Context data is shared by all
523
+ * entities within a window.
524
+ *
525
+ * @example
526
+ * Setting own context:
527
+ * ```js
528
+ * const platform = fin.Platform.getCurrentSync();
529
+ * const contextData = {
530
+ * security: 'STOCK',
531
+ * currentView: 'detailed'
532
+ * }
533
+ *
534
+ * await platform.setWindowContext(contextData);
535
+ * // Context of current window is now set to `contextData`
536
+ * ```
537
+ *
538
+ * Setting the context of another window or view:
539
+ * ```js
540
+ * const platform = fin.Platform.getCurrentSync();
541
+ * const contextData = {
542
+ * security: 'STOCK',
543
+ * currentView: 'detailed'
544
+ * }
545
+ *
546
+ * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
547
+ * await platform.setWindowContext(contextData, windowOrViewIdentity);
548
+ * // Context of the target window or view is now set to `contextData`
549
+ * ```
550
+ *
551
+ * A view can listen to changes to its host window's context by listening to the `host-context-changed` event.
552
+ * This event will fire when a host window's context is updated or when the view is reparented to a new window:
553
+ *
554
+ * ```js
555
+ * // From a view
556
+ * const contextChangeHandler = ({ context }) => {
557
+ * console.log('Host window\'s context has changed. New context data:', context);
558
+ * // react to new context data here
559
+ * }
560
+ * await fin.me.on('host-context-changed', contextChangeHandler);
561
+ *
562
+ * const platform = await fin.Platform.getCurrentSync();
563
+ * const contextData = {
564
+ * security: 'STOCK',
565
+ * currentView: 'detailed'
566
+ * }
567
+ * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
568
+ * ```
569
+ *
570
+ * To listen to a window's context updates, use the `context-changed` event:
571
+ * ```js
572
+ * // From a window
573
+ * const contextChangeHandler = ({ context }) => {
574
+ * console.log('This window\'s context has changed. New context data:', context);
575
+ * // react to new context data here
576
+ * }
577
+ * await fin.me.on('context-changed', contextChangeHandler);
578
+ *
579
+ * const platform = await fin.Platform.getCurrentSync();
580
+ * const contextData = {
581
+ * security: 'STOCK',
582
+ * currentView: 'detailed'
583
+ * }
584
+ * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
585
+ * ```
124
586
  * @experimental
125
587
  */
126
588
  setWindowContext(context?: any, target?: OpenFin.Identity): Promise<void>;
127
589
  /**
128
590
  * Get the context context of a host window that was previously set using {@link Platform#setWindowContext setWindowContext}.
129
591
  * The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
130
- * @param {Identity} [target] - A target window or view may optionally be provided. If no target is provided, target will be
592
+ * @param target - A target window or view may optionally be provided. If no target is provided, target will be
131
593
  * the current window (if called from a Window) or the current host window (if called from a View).
132
- * @return {Promise<any>}
133
- * @tutorial Platform.getWindowContext
594
+ *
595
+ * @remarks This method can be called from the window itself, or from any child view. Context data is shared
596
+ * by all entities within a window.
597
+ *
598
+ * @example
599
+ *
600
+ * Retrieving context from current window:
601
+ * ```js
602
+ * const platform = fin.Platform.getCurrentSync();
603
+ * const customContext = { answer: 42 };
604
+ * await platform.setWindowContext(customContext);
605
+ *
606
+ * const myContext = await platform.getWindowContext();
607
+ * console.log(myContext); // { answer: 42 }
608
+ * ```
609
+ *
610
+ * Retrieving the context of another window or view:
611
+ * ```js
612
+ * const platform = fin.Platform.getCurrentSync();
613
+ *
614
+ * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
615
+ *
616
+ * const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity);
617
+ * console.log(targetWindowContext); // context of target window
618
+ * ```
134
619
  * @experimental
135
620
  */
136
621
  getWindowContext(target?: OpenFin.Identity): Promise<any>;
137
622
  /**
138
623
  * Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
139
624
  * This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
140
- * @param {Identity} winId
141
- * @param {closeWindowoptions} [options]
142
- * @returns {Promise<void>}
143
- * @tutorial Platform.closeWindow
625
+ * @param winId
626
+ * @param options
627
+ *
628
+ * @remarks This method works by setting a `close-requested` handler on the Platform Window. If you have your own `close-requested` handler set on the Platform Window as well,
629
+ * it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
630
+ *
631
+ * @example
632
+ *
633
+ * ```js
634
+ * // Close the current Window inside a Window context
635
+ * const platform = await fin.Platform.getCurrent();
636
+ * platform.closeWindow(fin.me.identity);
637
+ *
638
+ * // Close the Window from inside a View context
639
+ * const platform = await fin.Platform.getCurrent();
640
+ * const parentWindow = await fin.me.getCurrentWindow();
641
+ * platform.closeWindow(parentWindow.identity);
642
+ *
643
+ * // Close the Window and do not fire the before unload handler on Views
644
+ * const platform = await fin.Platform.getCurrent();
645
+ * platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
646
+ * ```
144
647
  * @experimental
145
648
  */
146
649
  closeWindow(windowId: OpenFin.Identity, options?: {