@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
@@ -167,304 +167,398 @@ type ViewEvent = OpenFin.ViewEvent;
167
167
  * really no need to provide it.
168
168
  */
169
169
  /**
170
- * @classdesc A View can be used to embed additional web content into a Window.
170
+ * A View can be used to embed additional web content into a Window.
171
171
  * It is like a child window, except it is positioned relative to its owning window.
172
- * It has the ability to listen for <a href="tutorial-View.EventEmitter.html">View-specific events</a>.
172
+ * It has the ability to listen for {@link OpenFin.ViewEvents View-specific events}.
173
173
  *
174
174
  * By default, a View will try to share the same renderer process as other Views owned by its parent Application.
175
- * To change that behavior, see the processAffinity {@link View~options view option}.
175
+ * To change that behavior, see the processAffinity {@link OpenFin.ViewOptions view option}.
176
176
  *
177
177
  * A View's lifecycle is tied to its owning window and can be re-attached to a different window at any point during its lifecycle.
178
- * @class
179
- * @alias View
180
- * @hideconstructor
181
178
  */
182
179
  export declare class View extends WebContents<ViewEvent> {
183
180
  #private;
184
181
  identity: OpenFin.Identity;
185
- constructor(wire: Transport, identity: OpenFin.Identity);
186
- /**
187
- * Gets a base64 encoded image of the view or a part of it.
188
- * @function capturePage
189
- * @param { CapturePageOptions } [options] Options for the capturePage call.
190
- * @memberOf View
191
- * @instance
192
- * @return {Promise.<string>}
193
- * @tutorial View.capturePage
194
- */
195
182
  /**
196
- * Executes Javascript on the view, restricted to contents you own or contents owned by
197
- * applications you have created.
198
- * @param { string } code JavaScript code to be executed on the view.
199
- * @function executeJavaScript
200
- * @memberOf View
201
- * @instance
202
- * @return {Promise.<void>}
203
- * @tutorial View.executeJavaScript
183
+ * @internal
204
184
  */
185
+ constructor(wire: Transport, identity: OpenFin.Identity);
205
186
  /**
206
187
  * Focuses the view
207
- * @return {Promise.<void>}
188
+ *
208
189
  * @function focus
209
190
  * @memberof View
210
191
  * @emits focused
211
192
  * @instance
212
- * @tutorial View.focus
193
+ * @example
194
+ * ```js
195
+ * const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' });
196
+ * await view.focus();
197
+ * // do things with the focused view
198
+ * ```
213
199
  * @experimental
214
200
  */
215
201
  focus({ emitSynthFocused }?: {
216
202
  emitSynthFocused: boolean;
217
203
  }): Promise<void>;
218
204
  /**
219
- * Returns the zoom level of the view.
220
- * @function getZoomLevel
221
- * @memberOf View
222
- * @instance
223
- * @return {Promise.<number>}
224
- * @tutorial View.getZoomLevel
225
- */
226
- /**
227
- * Sets the zoom level of the view.
228
- * @param { number } level The zoom level
229
- * @function setZoomLevel
230
- * @memberOf View
231
- * @instance
232
- * @return {Promise.<void>}
233
- * @tutorial View.setZoomLevel
234
- */
235
- /**
236
- * Find and highlight text on a page.
237
- * @param { string } searchTerm Term to find in page
238
- * @param { FindInPageOptions } options Search options
239
- * @function findInPage
240
- * @memberOf View
241
- * @instance
242
- * @return {Promise.<number>}
243
- * @tutorial View.findInPage
244
- */
245
- /**
246
- * Stops any findInPage call with the provided action.
247
- * @param {string} action
248
- * Action to execute when stopping a find in page:<br>
249
- * "clearSelection" - Clear the selection.<br>
250
- * "keepSelection" - Translate the selection into a normal selection.<br>
251
- * "activateSelection" - Focus and click the selection node.<br>
252
- * @function stopFindInPage
253
- * @memberOf View
254
- * @instance
255
- * @return {Promise.<void>}
256
- * @tutorial View.stopFindInPage
257
- */
258
- /**
259
- * Navigates the view to a specified URL. The url must contain the protocol prefix such as http:// or https://.
260
- * @param { string } url - The URL to navigate the view to.
261
- * @return {Promise.<void>}
262
- * @function navigate
263
- * @memberof View
264
- * @instance
265
- * @tutorial View.navigate
266
- * @experimental
267
- */
268
- /**
269
- * Navigates the view back one page.
270
- * @function navigateBack
271
- * @memberOf View
272
- * @instance
273
- * @return {Promise.<void>}
274
- * @tutorial View.navigateBack
275
- */
276
- /**
277
- * Navigates the view forward one page.
278
- * @function navigateForward
279
- * @memberOf View
280
- * @instance
281
- * @return {Promise.<void>}
282
- * @tutorial View.navigateForward
283
- */
284
- /**
285
- * Stops any current navigation the view is performing.
286
- * @function stopNavigation
287
- * @memberOf View
288
- * @instance
289
- * @return {Promise.<void>}
290
- * @tutorial View.stopNavigation
291
- */
292
- /**
293
- * Reloads the view current page
294
- * @function reload
295
- * @memberOf View
296
- * @instance
297
- * @return {Promise.<void>}
298
- * @tutorial View.reload
299
- */
300
- /**
301
- * Prints the view's web page
302
- * @param { PrintOptions } [options] Printer Options
303
- * @function print
304
- * @memberOf View
305
- * @instance
306
- * @return {Promise.<void>}
307
- * @tutorial View.print
308
- */
309
- /**
310
- * Returns an array with all system printers
311
- * @deprecated use System.getPrinters instead
312
- * @function getPrinters
313
- * @memberOf View
314
- * @instance
315
- * @return { Promise.Array.<PrinterInfo> }
316
- * @tutorial View.getPrinters
317
- */
318
- /**
319
- * Shows the Chromium Developer Tools
320
- * @function showDeveloperTools
321
- * @memberOf View
322
- * @instance
323
- * @return {Promise.<void>}
324
- * @tutorial View.showDeveloperTools
325
- */
326
- /**
327
- * Retrieves the process information associated with a view.
328
- * @function getProcessInfo
329
- * @memberOf View
330
- * @instance
331
- * @return {Promise.<EntityProcessDetails>}
332
- * @tutorial View.getProcessInfo
333
- */
334
- /**
335
- * Retrieves information on all Shared Workers.
336
- * @function getSharedWorkers
337
- * @memberOf View
338
- * @instance
339
- * @return {Promise.Array.<SharedWorkerInfo>}
340
- * @tutorial View.getSharedWorkers
341
- */
342
- /**
343
- * Opens the developer tools for the shared worker context.
344
- * @function inspectSharedWorker
345
- * @memberOf View
346
- * @instance
347
- * @return {Promise.<void>}
348
- * @tutorial View.inspectSharedWorker
349
- */
350
- /**
351
- * Inspects the shared worker based on its ID.
352
- * @param { string } workerId - The id of the shared worker.
353
- * @function inspectSharedWorkerById
354
- * @memberOf View
355
- * @instance
356
- * @return {Promise.<void>}
357
- * @tutorial View.inspectSharedWorkerById
358
- */
359
- /**
360
- * Opens the developer tools for the service worker context.
361
- * @function inspectServiceWorker
362
- * @memberOf View
363
- * @instance
364
- * @return {Promise.<void>}
365
- * @tutorial View.inspectServiceWorker
366
- */
367
- /**
368
- * Shows a popup window. If the window this view is currently attached to has a popup open, closes it.
369
- * @function showPopupWindow
370
- * @memberOf View
371
- * @instance
372
- * @param {PopupOptions} options
373
- * @return {Promise<PopupResult>}
374
- * @tutorial View.showPopupWindow
375
- */
376
- /**
377
- * Attaches the current view to a the given window identity.
205
+ * Attaches the current view to the given window identity.
378
206
  * Identity must be the identity of a window in the same application.
379
207
  * This detaches the view from its current window, and sets the view to be destroyed when its new window closes.
380
208
  * @param target {Identity}
381
- * @return {Promise.<void>}
382
- * @tutorial View.attach
209
+ *
210
+ * @example
211
+ * ```js
212
+ * let view;
213
+ * async function createView() {
214
+ * const me = await fin.Window.getCurrent();
215
+ * return fin.View.create({
216
+ * name: 'viewNameAttach',
217
+ * target: me.identity,
218
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
219
+ * });
220
+ * }
221
+ *
222
+ * async function attachView() {
223
+ * view = await createView();
224
+ * console.log('View created.');
225
+ *
226
+ * await view.navigate('https://google.com');
227
+ * console.log('View navigated to given url.');
228
+ *
229
+ * const winOption = {
230
+ * name:'winOptionName',
231
+ * defaultWidth: 300,
232
+ * defaultHeight: 300,
233
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.create.html',
234
+ * frame: true,
235
+ * autoShow: true
236
+ * };
237
+ * const newWindow = await fin.Window.create(winOption);
238
+ * view.attach(newWindow.identity);
239
+ * }
240
+ *
241
+ * attachView()
242
+ * .then(() => console.log('View attached to new window.'))
243
+ * .catch(err => console.log(err));
244
+ * ```
383
245
  * @experimental
384
246
  */
385
247
  attach: (target: OpenFin.Identity) => Promise<void>;
386
248
  /**
387
249
  * Destroys the current view
388
- * @return {Promise.<void>}
389
- * @tutorial View.destroy
250
+ *
251
+ * @example
252
+ * ```js
253
+ * const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' });
254
+ * view.destroy();
255
+ * ```
390
256
  * @experimental
391
257
  */
392
258
  destroy: () => Promise<void>;
393
259
  /**
394
260
  * Shows the current view if it is currently hidden.
395
- * @return {Promise.<void>}
396
- * @tutorial View.show
261
+ *
262
+ * @example
263
+ * ```js
264
+ * let view;
265
+ * async function createView() {
266
+ * const me = await fin.Window.getCurrent();
267
+ * return fin.View.create({
268
+ * name: 'viewNameShow',
269
+ * target: me.identity,
270
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
271
+ * });
272
+ * }
273
+ *
274
+ * async function hideAndShowView() {
275
+ * view = await createView();
276
+ * console.log('View created.');
277
+ *
278
+ * await view.navigate('https://google.com');
279
+ * console.log('View navigated to given url option.');
280
+ *
281
+ * await view.hide();
282
+ * console.log("View hidden.");
283
+ *
284
+ * view.show();
285
+ * console.log("View shown.");
286
+ * }
287
+ *
288
+ * hideAndShowView()
289
+ * .then(() => console.log('View hidden and shown.'))
290
+ * .catch(err => console.log(err));
291
+ * ```
397
292
  * @experimental
398
293
  */
399
294
  show: () => Promise<void>;
400
295
  /**
401
296
  * Hides the current view if it is currently visible.
402
- * @return {Promise.<void>}
403
- * @tutorial View.hide
297
+ *
298
+ * @example
299
+ * ```js
300
+ * let view;
301
+ * async function createView() {
302
+ * const me = await fin.Window.getCurrent();
303
+ * return fin.View.create({
304
+ * name: 'viewNameHide',
305
+ * target: me.identity,
306
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
307
+ * });
308
+ * }
309
+ *
310
+ * async function hideView() {
311
+ * view = await createView();
312
+ * console.log('View created.');
313
+ *
314
+ * await view.navigate('https://google.com');
315
+ * console.log('View navigated to given url.');
316
+ *
317
+ * await view.hide();
318
+ * }
319
+ *
320
+ * hideView()
321
+ * .then(() => console.log('View hidden.'))
322
+ * .catch(err => console.log(err));
323
+ * ```
404
324
  * @experimental
405
325
  */
406
326
  hide: () => Promise<void>;
407
327
  /**
408
328
  * Sets the bounds (top, left, width, height) of the view relative to its window.
409
329
  * @param bounds {ViewBounds}
410
- * @return {Promise.<void>}
411
- * @tutorial View.setBounds
330
+ *
331
+ * @remarks View position is relative to the bounds of the window.
332
+ * ({top: 0, left: 0} represents the top left corner of the window)
333
+ *
334
+ * @example
335
+ * ```js
336
+ * let view;
337
+ * async function createView() {
338
+ * const me = await fin.Window.getCurrent();
339
+ * return fin.View.create({
340
+ * name: 'viewNameSetBounds',
341
+ * target: me.identity,
342
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
343
+ * });
344
+ * }
345
+ *
346
+ * async function setViewBounds() {
347
+ * view = await createView();
348
+ * console.log('View created.');
349
+ *
350
+ * await view.navigate('https://google.com');
351
+ * console.log('View navigated to given url.');
352
+ *
353
+ * await view.setBounds({
354
+ * top: 100,
355
+ * left: 100,
356
+ * width: 300,
357
+ * height: 300
358
+ * });
359
+ * }
360
+ *
361
+ * setViewBounds()
362
+ * .then(() => console.log('View set to new bounds.'))
363
+ * .catch(err => console.log(err));
364
+ * ```
412
365
  * @experimental
413
366
  */
414
367
  setBounds: (bounds: OpenFin.Bounds) => Promise<void>;
415
368
  /**
416
369
  * Gets the bounds (top, left, width, height) of the view relative to its window.
417
- * @return {Promise.<ViewBounds>}
418
- * @tutorial View.getBounds
370
+ *
371
+ * @remarks View position is relative to the bounds of the window.
372
+ * ({top: 0, left: 0} represents the top left corner of the window)
373
+ *
374
+ * @example
375
+ * ```js
376
+ * const view = await fin.View.create({
377
+ * name: 'viewNameSetBounds',
378
+ * target: fin.me.identity,
379
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
380
+ * });
381
+ *
382
+ * await view.navigate('https://google.com');
383
+ *
384
+ * await view.setBounds({
385
+ * top: 100,
386
+ * left: 100,
387
+ * width: 300,
388
+ * height: 300
389
+ * });
390
+ *
391
+ * console.log(await view.getBounds());
392
+ * ```
419
393
  * @experimental
420
394
  */
421
395
  getBounds: () => Promise<OpenFin.Bounds>;
422
396
  /**
423
397
  * Gets the View's info.
424
- * @return {Promise.<ViewInfo>}
425
- * @tutorial View.getInfo
398
+ *
399
+ * @example
400
+ * ```js
401
+ * let view;
402
+ * async function createView() {
403
+ * const me = await fin.Window.getCurrent();
404
+ * return fin.View.create({
405
+ * name: 'viewNameGetInfo',
406
+ * target: me.identity,
407
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
408
+ * });
409
+ * }
410
+ *
411
+ * async function getViewInfo() {
412
+ * view = await createView();
413
+ * console.log('View created.');
414
+ *
415
+ * await view.navigate('https://google.com');
416
+ * console.log('View navigated to given url.');
417
+ *
418
+ * return view.getInfo();
419
+ * }
420
+ *
421
+ * getViewInfo()
422
+ * .then((info) => console.log('View info fetched.', info))
423
+ * .catch(err => console.log(err));
424
+ * ```
426
425
  * @experimental
427
426
  */
428
427
  getInfo: () => Promise<OpenFin.ViewInfo>;
429
428
  /**
430
429
  * Retrieves the layout for the window the view is attached to.
431
- * @return {Promise.<Layout>}
432
- * @tutorial View.getParentLayout
430
+ *
431
+ * @example
432
+ * ```js
433
+ * //get the current View
434
+ * const view = await fin.View.getCurrent();
435
+ *
436
+ * //get a reference to the Layout for the Window the view is part of
437
+ * const layout = await view.getParentLayout();
438
+ * ```
433
439
  * @experimental
434
440
  */
435
441
  getParentLayout: () => Promise<OpenFin.Layout>;
436
442
  /**
437
443
  * Gets the View's options.
438
- * @return {Promise<ViewOptions>}
439
- * @tutorial View.getOptions
444
+ *
445
+ * @example
446
+ * ```js
447
+ * let view;
448
+ * async function createView() {
449
+ * const me = await fin.Window.getCurrent();
450
+ * return fin.View.create({
451
+ * name: 'viewNameGetOptions',
452
+ * target: me.identity,
453
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
454
+ * });
455
+ * }
456
+ *
457
+ * async function getViewOptions() {
458
+ * view = await createView();
459
+ * console.log('View created.');
460
+ *
461
+ * await view.navigate('https://google.com');
462
+ * console.log('View navigated to given url.');
463
+ *
464
+ * const me = await fin.Window.getCurrent();
465
+ * view = fin.View.wrapSync({ uuid: me.identity.uuid, name: 'viewNameGetOptions' });
466
+ * return view.getOptions();
467
+ * }
468
+ *
469
+ * getViewOptions()
470
+ * .then((info) => console.log('View options fetched.', info))
471
+ * .catch(err => console.log(err));
472
+ * ```
440
473
  * @experimental
441
474
  */
442
475
  getOptions: () => Promise<OpenFin.ViewOptions>;
443
476
  /**
444
477
  * Updates the view's options.
445
- * @param { Partial<ViewOptions> } options
446
- * @return {Promise.<void>}
447
- * @tutorial View.updateOptions
478
+ * @param options
479
+ *
480
+ * @example
481
+ * ```js
482
+ * let view;
483
+ * async function createView() {
484
+ * const me = await fin.Window.getCurrent();
485
+ * return fin.View.create({
486
+ * url: 'https://google.com',
487
+ * name: 'viewNameUpdateOptions',
488
+ * target: me.identity,
489
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
490
+ * });
491
+ * }
492
+ *
493
+ * async function updateViewOptions() {
494
+ * view = await createView();
495
+ * console.log('View created.');
496
+ *
497
+ * await view.navigate('https://google.com');
498
+ * console.log('View navigated to given url option.');
499
+ *
500
+ * const newOptions = { autoResize: {
501
+ * width: true,
502
+ * horizontal: true
503
+ * }};
504
+ * return view.updateOptions(newOptions);
505
+ * }
506
+ *
507
+ * updateViewOptions()
508
+ * .then(payload => console.log('View options updated: ', payload))
509
+ * .catch(err => console.log(err));
510
+ * ```
448
511
  * @experimental
449
512
  */
450
513
  updateOptions: (options: UpdatableViewOptions) => Promise<void>;
451
514
  /**
452
515
  * Retrieves the window the view is currently attached to.
453
- * @return {Promise.<_Window>}
516
+ *
454
517
  * @experimental
518
+ * @example
519
+ * ```js
520
+ * const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' });
521
+ * view.getCurrentWindow()
522
+ * .then(win => console.log('current window', win))
523
+ * .catch(err => console.log(err));)
524
+ * ```
455
525
  */
456
526
  getCurrentWindow: () => Promise<OpenFin.Window>;
457
527
  /**
458
- * Retrieves the current {@link TabStack} of the view if it belongs to one.
459
- * @return {Promise<TabStack>} The {@link TabStack} this view belongs to.
528
+ * Retrieves the current {@link OpenFin.TabStack} of the view if it belongs to one.
529
+ * @returns this view belongs to.
460
530
  * @throws if this view does not belong to a TabStack or if the window has been destroyed.
531
+ * @example
532
+ * ```js
533
+ * if (!fin.me.isView) {
534
+ * throw new Error('Not running in a platform View.');
535
+ * }
536
+ *
537
+ * const stack = await fin.me.getCurrentStack();
538
+ * // Alternatively, you can wrap any view and get the stack from there
539
+ * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
540
+ * // const stack = await viewFromSomewhere.getCurrentStack();
541
+ * const views = await stack.getViews();
542
+ * console.log(`Stack contains ${views.length} view(s)`);
543
+ * ```
461
544
  */
462
545
  getCurrentStack: () => Promise<OpenFin.TabStack>;
463
546
  /**
464
- * Triggers the before-unload handler for the View, if one is set. Returns `true` if the handler is trying to prevent the View from unloading, and `false` if it isn't.
465
- * Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will always return false.
466
- * @returns {Promise<boolean>}
467
- * @tutorial View.triggerBeforeUnload
547
+ * Triggers the before-unload handler for the View, if one is set.
548
+ *
549
+ * @remarks Returns `true` if the handler is trying to prevent the View from unloading, and `false` if it isn't.
550
+ * Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will
551
+ * always return false.
552
+ *
553
+ * This method is used internally by the Platform Provider to determine the status of each before unload handler in Views when closing the Window.
554
+ *
555
+ * @example
556
+ *
557
+ * ```js
558
+ * // from inside a View context
559
+ * const unloadPrevented = await fin.me.triggerBeforeUnload();
560
+ * ```
561
+ *
468
562
  * @experimental
469
563
  */
470
564
  triggerBeforeUnload: () => Promise<boolean>;
@@ -476,11 +570,31 @@ export declare class View extends WebContents<ViewEvent> {
476
570
  *
477
571
  * **Known issue**: When View.bindToElement is used on a element that takes up the entire page in a platform window, the bound view will not respond responsively when the window is resized to be smaller.
478
572
  *
479
- * @param {HTMLElement} element - HTML element to attach the view to.
480
- * @return {Function} - Cleanup function that will disconnect the element resize observer.
573
+ * @param element - HTML element to attach the view to.
574
+ * @returns - Cleanup function that will disconnect the element resize observer.
481
575
  * @internal
482
576
  * @experimental
483
- * @tutorial View.bindToElement
577
+ * @remarks View will resize accordingly when the element is resized. If the element is repositioned in the DOM the view will not be repositioned, to handle this case call `bindToElement` again once the element changes position.
578
+ *
579
+ * @example
580
+ * ```html
581
+ * <div id="view-container"></div>
582
+ * <script>
583
+ * async function createAndAttachView() {
584
+ * const url = 'https://example.com';
585
+ * const elementId = 'view-container';
586
+ * const element = document.getElementById(elementId);
587
+ * const view = await fin.View.create({
588
+ * name: 'my-view',
589
+ * url,
590
+ * target: fin.me.identity
591
+ * });
592
+ * await view.navigate(url);
593
+ * await view.bindToElement(element);
594
+ * }
595
+ * createAndAttachView().catch(console.error);
596
+ * </script>
597
+ * ```
484
598
  */
485
599
  bindToElement: (element: HTMLElement) => Promise<() => void>;
486
600
  }