@openfin/core 33.76.31 → 33.76.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/openfin-core-33.76.36.tgz +0 -0
  2. package/package.json +1 -1
  3. package/src/OpenFin.d.ts +27 -16
  4. package/src/api/application/Factory.d.ts +148 -100
  5. package/src/api/application/Factory.js +148 -100
  6. package/src/api/application/Instance.d.ts +477 -106
  7. package/src/api/application/Instance.js +474 -106
  8. package/src/api/application/index.d.ts +9 -0
  9. package/src/api/application/index.js +9 -0
  10. package/src/api/base.d.ts +69 -0
  11. package/src/api/base.js +69 -0
  12. package/src/api/clipboard/index.d.ts +111 -31
  13. package/src/api/clipboard/index.js +111 -31
  14. package/src/api/events/application.d.ts +12 -0
  15. package/src/api/events/application.js +12 -0
  16. package/src/api/events/channel.d.ts +5 -0
  17. package/src/api/events/channel.js +5 -0
  18. package/src/api/events/externalApplication.d.ts +5 -0
  19. package/src/api/events/externalApplication.js +5 -0
  20. package/src/api/events/frame.d.ts +5 -0
  21. package/src/api/events/globalHotkey.d.ts +5 -0
  22. package/src/api/events/platform.d.ts +9 -1
  23. package/src/api/events/platform.js +8 -0
  24. package/src/api/events/system.d.ts +13 -0
  25. package/src/api/events/system.js +13 -0
  26. package/src/api/events/view.d.ts +19 -9
  27. package/src/api/events/view.js +10 -0
  28. package/src/api/events/webcontents.d.ts +21 -10
  29. package/src/api/events/webcontents.js +11 -0
  30. package/src/api/events/window.d.ts +70 -1
  31. package/src/api/events/window.js +10 -0
  32. package/src/api/external-application/Factory.d.ts +16 -9
  33. package/src/api/external-application/Factory.js +16 -9
  34. package/src/api/external-application/Instance.d.ts +40 -32
  35. package/src/api/external-application/Instance.js +40 -32
  36. package/src/api/external-application/index.d.ts +9 -0
  37. package/src/api/external-application/index.js +9 -0
  38. package/src/api/fin.d.ts +3 -0
  39. package/src/api/fin.js +3 -0
  40. package/src/api/frame/Factory.d.ts +30 -13
  41. package/src/api/frame/Factory.js +30 -13
  42. package/src/api/frame/Instance.d.ts +51 -38
  43. package/src/api/frame/Instance.js +51 -38
  44. package/src/api/frame/index.d.ts +11 -0
  45. package/src/api/frame/index.js +11 -0
  46. package/src/api/global-hotkey/index.d.ts +81 -13
  47. package/src/api/global-hotkey/index.js +81 -13
  48. package/src/api/interappbus/channel/channel.d.ts +257 -0
  49. package/src/api/interappbus/channel/channel.js +257 -0
  50. package/src/api/interappbus/channel/channels-docs.d.ts +59 -57
  51. package/src/api/interappbus/channel/channels-docs.js +71 -68
  52. package/src/api/interappbus/channel/client.d.ts +93 -0
  53. package/src/api/interappbus/channel/client.js +93 -1
  54. package/src/api/interappbus/channel/index.d.ts +164 -0
  55. package/src/api/interappbus/channel/index.js +165 -1
  56. package/src/api/interappbus/channel/provider.d.ts +172 -0
  57. package/src/api/interappbus/channel/provider.js +172 -0
  58. package/src/api/interappbus/index.d.ts +55 -20
  59. package/src/api/interappbus/index.js +55 -20
  60. package/src/api/interop/Factory.d.ts +30 -10
  61. package/src/api/interop/Factory.js +30 -10
  62. package/src/api/interop/InteropBroker.d.ts +298 -70
  63. package/src/api/interop/InteropBroker.js +298 -70
  64. package/src/api/interop/InteropClient.d.ts +286 -62
  65. package/src/api/interop/InteropClient.js +286 -62
  66. package/src/api/interop/SessionContextGroupClient.d.ts +2 -2
  67. package/src/api/interop/SessionContextGroupClient.js +2 -2
  68. package/src/api/interop/fdc3/documentationStub.d.ts +14 -0
  69. package/src/api/interop/fdc3/documentationStub.js +17 -0
  70. package/src/api/interop/fdc3/fdc3-1.2.d.ts +31 -34
  71. package/src/api/interop/fdc3/fdc3-1.2.js +31 -34
  72. package/src/api/interop/fdc3/fdc3-2.0.d.ts +48 -51
  73. package/src/api/interop/fdc3/fdc3-2.0.js +48 -51
  74. package/src/api/interop/index.d.ts +8 -0
  75. package/src/api/interop/index.js +8 -0
  76. package/src/api/platform/Factory.d.ts +121 -65
  77. package/src/api/platform/Factory.js +122 -66
  78. package/src/api/platform/Instance.d.ts +551 -48
  79. package/src/api/platform/Instance.js +551 -49
  80. package/src/api/platform/index.d.ts +9 -0
  81. package/src/api/platform/index.js +9 -0
  82. package/src/api/platform/layout/Factory.d.ts +53 -76
  83. package/src/api/platform/layout/Factory.js +53 -76
  84. package/src/api/platform/layout/Instance.d.ts +158 -23
  85. package/src/api/platform/layout/Instance.js +118 -20
  86. package/src/api/platform/layout/entities/layout-entities.d.ts +222 -30
  87. package/src/api/platform/layout/entities/layout-entities.js +222 -30
  88. package/src/api/platform/layout/index.d.ts +9 -0
  89. package/src/api/platform/layout/index.js +9 -0
  90. package/src/api/platform/provider.d.ts +398 -51
  91. package/src/api/snapshot-source/Factory.d.ts +33 -18
  92. package/src/api/snapshot-source/Factory.js +33 -18
  93. package/src/api/snapshot-source/Instance.d.ts +30 -8
  94. package/src/api/snapshot-source/Instance.js +30 -8
  95. package/src/api/snapshot-source/index.d.ts +9 -0
  96. package/src/api/snapshot-source/index.js +9 -0
  97. package/src/api/system/index.d.ts +1137 -186
  98. package/src/api/system/index.js +1142 -186
  99. package/src/api/view/Factory.d.ts +54 -16
  100. package/src/api/view/Factory.js +54 -16
  101. package/src/api/view/Instance.d.ts +330 -216
  102. package/src/api/view/Instance.js +331 -217
  103. package/src/api/view/index.d.ts +9 -0
  104. package/src/api/view/index.js +9 -0
  105. package/src/api/webcontents/main.d.ts +890 -0
  106. package/src/api/webcontents/main.js +890 -0
  107. package/src/api/window/Factory.d.ts +67 -16
  108. package/src/api/window/Factory.js +67 -16
  109. package/src/api/window/Instance.d.ts +824 -316
  110. package/src/api/window/Instance.js +822 -320
  111. package/src/api/window/index.d.ts +11 -0
  112. package/src/api/window/index.js +11 -0
  113. package/src/namespaces.d.ts +1 -0
  114. package/src/namespaces.js +3 -1
  115. package/src/shapes/protocol.d.ts +4 -0
  116. package/openfin-core-33.76.31.tgz +0 -0
@@ -471,24 +471,24 @@ this animation onto the end of the animation queue.
471
471
  * @property { number } bottom Get the application bottom bound
472
472
  */
473
473
  /**
474
- * @classdesc A basic window that wraps a native HTML window. Provides more fine-grained
474
+ * A basic window that wraps a native HTML window. Provides more fine-grained
475
475
  * control over the window state such as the ability to minimize, maximize, restore, etc.
476
476
  * By default a window does not show upon instantiation; instead the window's show() method
477
477
  * must be invoked manually. The new window appears in the same process as the parent window.
478
- * It has the ability to listen for <a href="tutorial-Window.EventEmitter.html">window specific events</a>.
479
- * @class
480
- * @alias Window
481
- * @hideconstructor
478
+ * It has the ability to listen for {@link OpenFin.WindowEvents window specific events}.
482
479
  */
483
480
  export declare class _Window extends WebContents<OpenFin.WindowEvent> {
484
481
  identity: OpenFin.Identity;
482
+ /**
483
+ * @internal
484
+ */
485
485
  constructor(wire: Transport, identity: OpenFin.Identity);
486
486
  /**
487
487
  * Adds a listener to the end of the listeners array for the specified event.
488
- * @param { string | symbol } eventType - The type of the event.
489
- * @param { Function } listener - Called whenever an event of the specified type occurs.
490
- * @param { SubOptions } [options] - Option to support event timestamps.
491
- * @return {Promise.<this>}
488
+ * @param eventType - The type of the event.
489
+ * @param listener - Called whenever an event of the specified type occurs.
490
+ * @param options - Option to support event timestamps.
491
+ *
492
492
  * @function addListener
493
493
  * @memberof Window
494
494
  * @instance
@@ -496,10 +496,10 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
496
496
  */
497
497
  /**
498
498
  * Adds a listener to the end of the listeners array for the specified event.
499
- * @param { string | symbol } eventType - The type of the event.
500
- * @param { Function } listener - Called whenever an event of the specified type occurs.
501
- * @param { SubOptions } [options] - Option to support event timestamps.
502
- * @return {Promise.<this>}
499
+ * @param eventType - The type of the event.
500
+ * @param listener - Called whenever an event of the specified type occurs.
501
+ * @param options - Option to support event timestamps.
502
+ *
503
503
  * @function on
504
504
  * @memberof Window
505
505
  * @instance
@@ -507,10 +507,10 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
507
507
  */
508
508
  /**
509
509
  * 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.
510
- * @param { string | symbol } eventType - The type of the event.
511
- * @param { Function } listener - The callback function.
512
- * @param { SubOptions } [options] - Option to support event timestamps.
513
- * @return {Promise.<this>}
510
+ * @param eventType - The type of the event.
511
+ * @param listener - The callback function.
512
+ * @param options - Option to support event timestamps.
513
+ *
514
514
  * @function once
515
515
  * @memberof Window
516
516
  * @instance
@@ -518,10 +518,10 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
518
518
  */
519
519
  /**
520
520
  * Adds a listener to the beginning of the listeners array for the specified event.
521
- * @param { string | symbol } eventType - The type of the event.
522
- * @param { Function } listener - The callback function.
523
- * @param { SubOptions } [options] - Option to support event timestamps.
524
- * @return {Promise.<this>}
521
+ * @param eventType - The type of the event.
522
+ * @param listener - The callback function.
523
+ * @param options - Option to support event timestamps.
524
+ *
525
525
  * @function prependListener
526
526
  * @memberof Window
527
527
  * @instance
@@ -530,10 +530,10 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
530
530
  /**
531
531
  * 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.
532
532
  * The listener is added to the beginning of the listeners array.
533
- * @param { string | symbol } eventType - The type of the event.
534
- * @param { Function } listener - The callback function.
535
- * @param { SubOptions } [options] - Option to support event timestamps.
536
- * @return {Promise.<this>}
533
+ * @param eventType - The type of the event.
534
+ * @param listener - The callback function.
535
+ * @param options - Option to support event timestamps.
536
+ *
537
537
  * @function prependOnceListener
538
538
  * @memberof Window
539
539
  * @instance
@@ -542,10 +542,10 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
542
542
  /**
543
543
  * Remove a listener from the listener array for the specified event.
544
544
  * Caution: Calling this method changes the array indices in the listener array behind the listener.
545
- * @param { string | symbol } eventType - The type of the event.
546
- * @param { Function } listener - The callback function.
547
- * @param { SubOptions } [options] - Option to support event timestamps.
548
- * @return {Promise.<this>}
545
+ * @param eventType - The type of the event.
546
+ * @param listener - The callback function.
547
+ * @param options - Option to support event timestamps.
548
+ *
549
549
  * @function removeListener
550
550
  * @memberof Window
551
551
  * @instance
@@ -553,320 +553,442 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
553
553
  */
554
554
  /**
555
555
  * Removes all listeners, or those of the specified event.
556
- * @param { string | symbol } [eventType] - The type of the event.
557
- * @return {Promise.<this>}
556
+ * @param eventType - The type of the event.
557
+ *
558
558
  * @function removeAllListeners
559
559
  * @memberof Window
560
560
  * @instance
561
561
  * @tutorial Window.EventEmitter
562
562
  */
563
- /**
564
- * Gets a base64 encoded image of the window or a part of it.
565
- * @function capturePage
566
- * @param { CapturePageOptions } [options] options for capturePage call.
567
- * @return {Promise.<string>}
568
- * @memberof Window
569
- * @instance
570
- * @tutorial Window.capturePage
571
- */
572
- /**
573
- * Executes Javascript on the window, restricted to windows you own or windows owned by
574
- * applications you have created.
575
- * @param { string } code JavaScript code to be executed on the window.
576
- * @function executeJavaScript
577
- * @memberOf Window
578
- * @instance
579
- * @return {Promise.<void>}
580
- * @tutorial Window.executeJavaScript
581
- */
582
- /**
583
- * Gives focus to the window.
584
- * @return {Promise.<void>}
585
- * @function focus
586
- * @emits focused
587
- * @memberOf Window
588
- * @instance
589
- * @tutorial Window.focus
590
- */
591
- /**
592
- * Returns the zoom level of the window.
593
- * @function getZoomLevel
594
- * @memberOf Window
595
- * @instance
596
- * @return {Promise.<number>}
597
- * @tutorial Window.getZoomLevel
598
- */
599
- /**
600
- * Sets the zoom level of the window.
601
- * @param { number } level The zoom level
602
- * @function setZoomLevel
603
- * @memberOf Window
604
- * @instance
605
- * @return {Promise.<void>}
606
- * @tutorial Window.setZoomLevel
607
- */
608
- /**
609
- * Find and highlight text on a page.
610
- * @param { string } searchTerm Term to find in page
611
- * @param { FindInPageOptions } options Search options
612
- * @function findInPage
613
- * @memberOf Window
614
- * @instance
615
- * @return {Promise.<number>}
616
- * @tutorial Window.findInPage
617
- */
618
- /**
619
- * Stops any findInPage call with the provided action.
620
- * @param {string} action
621
- * Action to execute when stopping a find in page:<br>
622
- * "clearSelection" - Clear the selection.<br>
623
- * "keepSelection" - Translate the selection into a normal selection.<br>
624
- * "activateSelection" - Focus and click the selection node.<br>
625
- * @function stopFindInPage
626
- * @memberOf Window
627
- * @instance
628
- * @return {Promise.<void>}
629
- * @tutorial Window.stopFindInPage
630
- */
631
- /**
632
- * Navigates the window to a specified URL. The url must contain the protocol prefix such as http:// or https://.
633
- * @param {string} url - The URL to navigate the window to.
634
- * @function navigate
635
- * @memberOf Window
636
- * @instance
637
- * @return {Promise.<void>}
638
- * @tutorial Window.navigate
639
- */
640
- /**
641
- * Navigates the window back one page.
642
- * @function navigateBack
643
- * @memberOf Window
644
- * @instance
645
- * @return {Promise.<void>}
646
- * @tutorial Window.navigateBack
647
- */
648
- /**
649
- * Navigates the window forward one page.
650
- * @function navigateForward
651
- * @memberOf Window
652
- * @instance
653
- * @return {Promise.<void>}
654
- * @tutorial Window.navigateForward
655
- */
656
- /**
657
- * Stops any current navigation the window is performing.
658
- * @function stopNavigation
659
- * @memberOf Window
660
- * @instance
661
- * @return {Promise.<void>}
662
- * @tutorial Window.stopNavigation
663
- */
664
- /**
665
- * Reloads the window current page
666
- * @function reload
667
- * @memberOf Window
668
- * @instance
669
- * @return {Promise.<void>}
670
- * @tutorial Window.reload
671
- */
672
- /**
673
- * Prints the window's web page
674
- * @param { PrintOptions } [options] Printer Options
675
- * @function print
676
- * @memberOf Window
677
- * @instance
678
- * @return {Promise.<void>}
679
- * @tutorial Window.print
680
- */
681
- /**
682
- * Returns an array with all system printers
683
- * @deprecated use System.getPrinters instead
684
- * @function getPrinters
685
- * @memberOf Window
686
- * @instance
687
- * @return { Promise.Array.<PrinterInfo> }
688
- * @tutorial Window.getPrinters
689
- */
690
- /**
691
- * Retrieves the process information associated with a window.
692
- * @function getProcessInfo
693
- * @memberOf Window
694
- * @instance
695
- * @return {Promise.<EntityProcessDetails>}
696
- * @tutorial Window.getProcessInfo
697
- */
698
- /**
699
- * Retrieves information on all Shared Workers.
700
- * @function getSharedWorkers
701
- * @memberOf Window
702
- * @instance
703
- * @return {Promise.Array.<SharedWorkerInfo>}
704
- * @tutorial Window.getSharedWorkers
705
- */
706
- /**
707
- * Opens the developer tools for the shared worker context.
708
- * @function inspectSharedWorker
709
- * @memberOf Window
710
- * @instance
711
- * @return {Promise.<void>}
712
- * @tutorial Window.inspectSharedWorker
713
- */
714
- /**
715
- * Inspects the shared worker based on its ID.
716
- * @param { string } workerId - The id of the shared worker.
717
- * @function inspectSharedWorkerById
718
- * @memberOf Window
719
- * @instance
720
- * @return {Promise.<void>}
721
- * @tutorial Window.inspectSharedWorkerById
722
- */
723
- /**
724
- * Opens the developer tools for the service worker context.
725
- * @function inspectServiceWorker
726
- * @memberOf Window
727
- * @instance
728
- * @return {Promise.<void>}
729
- * @tutorial Window.inspectServiceWorker
730
- */
731
563
  createWindow(options: OpenFin.WindowCreationOptions): Promise<OpenFin.Window>;
732
564
  /**
733
565
  * Retrieves an array of frame info objects representing the main frame and any
734
566
  * iframes that are currently on the page.
735
- * @return {Promise.<Array<FrameInfo>>}
736
- * @tutorial Window.getAllFrames
567
+ *
568
+ * @example
569
+ * ```js
570
+ * async function getAllFrames() {
571
+ * const app = await fin.Application.start({
572
+ * name: 'myApp',
573
+ * uuid: 'app-1',
574
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getAllFrames.html',
575
+ * autoShow: true
576
+ * });
577
+ * const win = await app.getWindow();
578
+ * return await win.getAllFrames();
579
+ * }
580
+ *
581
+ * getAllFrames().then(framesInfo => console.log(framesInfo)).catch(err => console.log(err));
582
+ * ```
737
583
  */
738
584
  getAllFrames(): Promise<Array<OpenFin.FrameInfo>>;
739
585
  /**
740
586
  * Gets the current bounds (top, bottom, right, left, width, height) of the window.
741
- * @return {Promise.<Bounds>}
742
- * @tutorial Window.getBounds
587
+ *
588
+ * @example
589
+ * ```js
590
+ * async function getBounds() {
591
+ * const app = await fin.Application.start({
592
+ * name: 'myApp',
593
+ * uuid: 'app-3',
594
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getBounds.html',
595
+ * autoShow: true
596
+ * });
597
+ * const win = await app.getWindow();
598
+ * return await win.getBounds();
599
+ * }
600
+ *
601
+ * getBounds().then(bounds => console.log(bounds)).catch(err => console.log(err));
602
+ * ```
743
603
  */
744
604
  getBounds(): Promise<OpenFin.WindowBounds>;
745
605
  /**
746
606
  * Centers the window on its current screen.
747
- * @return {Promise.<void>}
748
- * @tutorial Window.center
607
+ *
608
+ * @remarks Does not have an effect on minimized or maximized windows.
609
+ *
610
+ * @example
611
+ * ```js
612
+ * async function centerWindow() {
613
+ * const app = await fin.Application.start({
614
+ * name: 'myApp',
615
+ * uuid: 'app-1',
616
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.center.html',
617
+ * autoShow: true
618
+ * });
619
+ * const win = await app.getWindow();
620
+ * return await win.center();
621
+ * }
622
+ *
623
+ * centerWindow().then(() => console.log('Window centered')).catch(err => console.log(err));
624
+ * ```
625
+ *
749
626
  */
750
627
  center(): Promise<void>;
751
628
  /**
752
629
  * Removes focus from the window.
753
- * @return {Promise.<void>}
754
- * @tutorial Window.blur
630
+ *
631
+ * @example
632
+ * ```js
633
+ * async function blurWindow() {
634
+ * const app = await fin.Application.start({
635
+ * name: 'myApp',
636
+ * uuid: 'app-1',
637
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.blur.html',
638
+ * autoShow: true
639
+ * });
640
+ * const win = await app.getWindow();
641
+ * return await win.blur();
642
+ * }
643
+ *
644
+ * blurWindow().then(() => console.log('Blured Window')).catch(err => console.log(err));
645
+ * ```
755
646
  */
756
647
  blur(): Promise<void>;
757
648
  /**
758
649
  * Brings the window to the front of the window stack.
759
- * @return {Promise.<void>}
760
- * @tutorial Window.bringToFront
650
+ *
651
+ * @example
652
+ * ```js
653
+ * async function BringWindowToFront() {
654
+ * const app = await fin.Application.start({
655
+ * name: 'myApp',
656
+ * uuid: 'app-1',
657
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.bringToFront.html',
658
+ * autoShow: true
659
+ * });
660
+ * const win = await app.getWindow();
661
+ * return await win.bringToFront();
662
+ * }
663
+ *
664
+ * BringWindowToFront().then(() => console.log('Window is in the front')).catch(err => console.log(err));
665
+ * ```
761
666
  */
762
667
  bringToFront(): Promise<void>;
763
668
  /**
764
669
  * Performs the specified window transitions.
765
- * @param {Transition} transitions - Describes the animations to perform. See the tutorial.
766
- * @param {TransitionOptions} options - Options for the animation. See the tutorial.
767
- * @return {Promise.<void>}
768
- * @tutorial Window.animate
670
+ * @param transitions - Describes the animations to perform. See the tutorial.
671
+ * @param options - Options for the animation. See the tutorial.
672
+ *
673
+ * @example
674
+ * ```
675
+ * async function animateWindow() {
676
+ * const transitions = {
677
+ * opacity: {
678
+ * opacity: 0.7,
679
+ * duration: 500
680
+ * },
681
+ * position: {
682
+ * top: 100,
683
+ * left: 100,
684
+ * duration: 500,
685
+ * relative: true
686
+ * }
687
+ * };
688
+ * const options = {
689
+ * interrupt: true,
690
+ * tween: 'ease-in'
691
+ * };
692
+ *
693
+ * const win = await fin.Window.getCurrent();
694
+ * return win.animate(transitions, options);
695
+ * }
696
+ *
697
+ * animateWindow()
698
+ * .then(() => console.log('Animation done'))
699
+ * .catch(err => console.error(err));
700
+ * ```
769
701
  */
770
702
  animate(transitions: OpenFin.Transition, options: OpenFin.TransitionOptions): Promise<void>;
771
703
  /**
772
704
  * Hides the window.
773
- * @return {Promise.<void>}
774
- * @tutorial Window.hide
705
+ *
706
+ * @example
707
+ * ```js
708
+ * async function hideWindow() {
709
+ * const app = await fin.Application.start({
710
+ * name: 'myApp',
711
+ * uuid: 'app-1',
712
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.hide.html',
713
+ * autoShow: true
714
+ * });
715
+ * const win = await app.getWindow();
716
+ * return await win.hide();
717
+ * }
718
+ *
719
+ * hideWindow().then(() => console.log('Window is hidden')).catch(err => console.log(err));
720
+ * ```
775
721
  */
776
722
  hide(): Promise<void>;
777
723
  /**
778
724
  * closes the window application
779
- * @param { boolean } [force = false] Close will be prevented from closing when force is false and
725
+ * @param force Close will be prevented from closing when force is false and
780
726
  * ‘close-requested’ has been subscribed to for application’s main window.
781
- * @return {Promise.<void>}
782
- * @tutorial Window.close
727
+ *
728
+ * @example
729
+ * ```js
730
+ * async function closeWindow() {
731
+ * const app = await fin.Application.start({
732
+ * name: 'myApp',
733
+ * uuid: 'app-3',
734
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.close.html',
735
+ * autoShow: true
736
+ * });
737
+ * const win = await app.getWindow();
738
+ * return await win.close();
739
+ * }
740
+ *
741
+ * closeWindow().then(() => console.log('Window closed')).catch(err => console.log(err));
742
+ * ```
783
743
  */
784
744
  close(force?: boolean): Promise<void>;
785
745
  focusedWebViewWasChanged(): Promise<void>;
786
746
  /**
787
747
  * Returns the native OS level Id.
788
- * In Windows, it will return the Windows [handle](https://docs.microsoft.com/en-us/windows/desktop/WinProg/windows-data-types#HWND).
789
- * @return {Promise.<string>}
790
- * @tutorial Window.getNativeId
748
+ *
749
+ * @remarks In Windows, it will return the Windows [handle](https://docs.microsoft.com/en-us/windows/desktop/WinProg/windows-data-types#HWND).
750
+ *
751
+ * @example
752
+ * ```js
753
+ * async function getWindowNativeId() {
754
+ * const app = await fin.Application.start({
755
+ * name: 'myApp',
756
+ * uuid: 'app-3',
757
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getNativeId.html',
758
+ * autoShow: true
759
+ * });
760
+ * const win = await app.getWindow();
761
+ * return await win.getNativeId();
762
+ * }
763
+ *
764
+ * getWindowNativeId().then(nativeId => console.log(nativeId)).catch(err => console.log(err));
765
+ * ```
791
766
  */
792
767
  getNativeId(): Promise<string>;
793
768
  /**
794
769
  * Retrieves window's attached views.
795
770
  * @experimental
796
- * @return {Promise.Array.<View>}
797
- * @tutorial Window.getCurrentViews
771
+ *
772
+ * @example
773
+ * ```js
774
+ * const win = fin.Window.getCurrentSync();
775
+ *
776
+ * win.getCurrentViews()
777
+ * .then(views => console.log(views))
778
+ * .catch(console.error);
779
+ * ```
798
780
  */
799
781
  getCurrentViews(): Promise<OpenFin.View[]>;
782
+ /**
783
+ * @deprecated Use {@link Window._Window.disableUserMovement} instead.
784
+ */
800
785
  disableFrame(): Promise<void>;
801
786
  /**
802
787
  * Prevents a user from changing a window's size/position when using the window's frame.
803
- * @return {Promise.<void>}
804
- * @tutorial Window.disableUserMovement
788
+ *
789
+ * @example
790
+ * ```js
791
+ * async function disableUserMovement() {
792
+ * const app = await fin.Application.start({
793
+ * name: 'myApp',
794
+ * uuid: 'app-3',
795
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.disableFrame.html',
796
+ * autoShow: true
797
+ * });
798
+ * const win = await app.getWindow();
799
+ * return await win.disableUserMovement();
800
+ * }
801
+ *
802
+ * disableUserMovement().then(() => console.log('Window is disabled')).catch(err => console.log(err));
803
+ * ```
805
804
  */
806
805
  disableUserMovement(): Promise<void>;
806
+ /**
807
+ * @deprecated Use {@link Window._Window.enableUserMovement} instead.
808
+ */
807
809
  enableFrame(): Promise<void>;
808
810
  /**
809
811
  * Re-enables user changes to a window's size/position when using the window's frame.
810
- * @return {Promise.<void>}
811
- * @tutorial Window.enableUserMovement
812
+ *
813
+ * @example
814
+ * ```js
815
+ * async function enableUserMovement() {
816
+ * const app = await fin.Application.start({
817
+ * name: 'myApp',
818
+ * uuid: 'app-3',
819
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.enableFrame.html',
820
+ * autoShow: true
821
+ * });
822
+ * const win = await app.getWindow();
823
+ * return await win.enableUserMovement();
824
+ * }
825
+ *
826
+ * enableUserMovement().then(() => console.log('Window is enabled')).catch(err => console.log(err));
827
+ * ```
812
828
  */
813
829
  enableUserMovement(): Promise<void>;
814
830
  /**
815
831
  * Flashes the window’s frame and taskbar icon until stopFlashing is called or until a focus event is fired.
816
- * @return {Promise.<void>}
817
- * @tutorial Window.flash
832
+ *
833
+ * @remarks On macOS flash only works on inactive windows.
834
+ * @example
835
+ * ```js
836
+ * async function windowFlash() {
837
+ * const app = await fin.Application.start({
838
+ * name: 'myApp',
839
+ * uuid: 'app-1',
840
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.flash.html',
841
+ * autoShow: true
842
+ * });
843
+ * const win = await app.getWindow();
844
+ * return await win.flash();
845
+ * }
846
+ *
847
+ * windowFlash().then(() => console.log('Window flashing')).catch(err => console.log(err));
848
+ * ```
818
849
  */
819
850
  flash(): Promise<void>;
820
851
  /**
821
852
  * Stops the taskbar icon from flashing.
822
- * @return {Promise.<void>}
823
- * @tutorial Window.stopFlashing
853
+ *
854
+ * @example
855
+ * ```js
856
+ * async function stopWindowFlashing() {
857
+ * const app = await fin.Application.start({
858
+ * name: 'myApp',
859
+ * uuid: 'app-1',
860
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.stopFlashing.html',
861
+ * autoShow: true
862
+ * });
863
+ * const win = await app.getWindow();
864
+ * return await win.stopFlashing();
865
+ * }
866
+ *
867
+ * stopWindowFlashing().then(() => console.log('Application window flashing')).catch(err => console.log(err));
868
+ * ```
824
869
  */
825
870
  stopFlashing(): Promise<void>;
826
871
  /**
827
872
  * Gets an information object for the window.
828
- * @return {Promise.<WindowInfo>}
829
- * @tutorial Window.getInfo
873
+ *
874
+ * @example
875
+ * ```js
876
+ * async function getInfo() {
877
+ * const app = await fin.Application.start({
878
+ * name: 'myApp',
879
+ * uuid: 'app-1',
880
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getInfo.html',
881
+ * autoShow: true
882
+ * });
883
+ * const win = await app.getWindow();
884
+ * return await win.getInfo();
885
+ * }
886
+ *
887
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
888
+ * ```
830
889
  */
831
890
  getInfo(): Promise<OpenFin.WindowInfo>;
832
891
  /**
833
892
  * Retrieves the window's Layout
834
- * @return {Promise.<Layout>}
835
- * @tutorial Window.getLayout
893
+ *
894
+ * @example
895
+ * ```js
896
+ * //get the current window
897
+ * const window = await fin.Window.getCurrent();
898
+ *
899
+ * //get the layout for the window
900
+ * const layout = await window.getLayout();
901
+ * ```
836
902
  * @experimental
837
903
  */
838
904
  getLayout(): Promise<OpenFin.Layout>;
839
905
  /**
840
906
  * Gets the current settings of the window.
841
- * @return {Promise.<any>}
842
- * @tutorial Window.getOptions
907
+ *
908
+ * @example
909
+ * ```js
910
+ * async function getWindowOptions() {
911
+ * const app = await fin.Application.start({
912
+ * name: 'myApp',
913
+ * uuid: 'app-1',
914
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getOptions.html',
915
+ * autoShow: true
916
+ * });
917
+ * const win = await app.getWindow();
918
+ * return await win.getOptions();
919
+ * }
920
+ *
921
+ * getWindowOptions().then(opts => console.log(opts)).catch(err => console.log(err));
922
+ * ```
843
923
  */
844
924
  getOptions(): Promise<OpenFin.WindowOptions>;
845
925
  /**
846
926
  * Gets the parent application.
847
- * @return {Promise.<Application>}
848
- * @tutorial Window.getParentApplication
927
+ *
928
+ * @example
929
+ * ```js
930
+ * async function getParentApplication() {
931
+ * const app = await fin.Application.start({
932
+ * name: 'myApp',
933
+ * uuid: 'app-1',
934
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getParentApplication.html',
935
+ * autoShow: true
936
+ * });
937
+ * const win = await app.getWindow();
938
+ * return await win.getParentApplication();
939
+ * }
940
+ *
941
+ * getParentApplication().then(parentApplication => console.log(parentApplication)).catch(err => console.log(err));
942
+ * ```
849
943
  */
850
944
  getParentApplication(): Promise<OpenFin.Application>;
851
945
  /**
852
946
  * Gets the parent window.
853
- * @return {Promise.<_Window>}
854
- * @tutorial Window.getParentWindow
947
+ *
948
+ * @example
949
+ * ```js
950
+ * async function getParentWindow() {
951
+ * const app = await fin.Application.start({
952
+ * name: 'myApp',
953
+ * uuid: 'app-1',
954
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getParentWindow.html',
955
+ * autoShow: true
956
+ * });
957
+ * const win = await app.getWindow();
958
+ * return await win.getParentWindow();
959
+ * }
960
+ *
961
+ * getParentWindow().then(parentWindow => console.log(parentWindow)).catch(err => console.log(err));
962
+ * ```
855
963
  */
856
964
  getParentWindow(): Promise<OpenFin.Window>;
857
965
  /**
858
966
  * ***DEPRECATED - please use Window.capturePage.***
859
967
  * Gets a base64 encoded PNG image of the window or just part a of it.
860
- * @param { Area } [area] The area of the window to be captured.
968
+ * @param area The area of the window to be captured.
861
969
  * Omitting it will capture the whole visible window.
862
- * @return {Promise.<string>}
970
+ *
863
971
  * @tutorial Window.capturePage
864
972
  */
865
973
  getSnapshot(area?: OpenFin.Rectangle): Promise<string>;
866
974
  /**
867
975
  * Gets the current state ("minimized", "maximized", or "normal") of the window.
868
- * @return {Promise.<string>}
869
- * @tutorial Window.getState
976
+ *
977
+ * @example
978
+ * ```js
979
+ * async function getWindowState() {
980
+ * const app = await fin.Application.start({
981
+ * name: 'myApp',
982
+ * uuid: 'app-1',
983
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getState.html',
984
+ * autoShow: true
985
+ * });
986
+ * const win = await app.getWindow();
987
+ * return await win.getState();
988
+ * }
989
+ *
990
+ * getWindowState().then(winState => console.log(winState)).catch(err => console.log(err));
991
+ * ```
870
992
  */
871
993
  getState(): Promise<'minimized' | 'maximized' | 'normal'>;
872
994
  /**
@@ -876,130 +998,408 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
876
998
  * you would get from calling [window.open()](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) in a standard web context.
877
999
  * The target window needs to be in the same application as the requesting window
878
1000
  * as well as comply with [same-origin](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) policy requirements.
879
- * @return {object}
880
- * @tutorial Window.getWebWindow
1001
+ *
1002
+ * @example
1003
+ * Injecting content into an empty window:
1004
+ *
1005
+ * ```js
1006
+ * (async ()=> {
1007
+ * try {
1008
+ * const winName = `child-window-${Date.now()}`;
1009
+ * const win = await fin.Window.create({
1010
+ * name: winName,
1011
+ * url: 'about:blank'
1012
+ * });
1013
+ * win.getWebWindow().document.write('<h1>Hello World</h1>');
1014
+ * } catch (err) {
1015
+ * console.error(err);
1016
+ * }
1017
+ * })();
1018
+ * ```
1019
+ *
1020
+ * Cloning DOM elements from the parent window (in this example we clone an `h3` element from the parent window):
1021
+ * ```js
1022
+ * (async ()=> {
1023
+ * try {
1024
+ * const currentWindow = await fin.Window.getCurrent();
1025
+ * const parentWindow = await currentWindow.getParentWindow();
1026
+ * const clonedH3 = parentWindow.getWebWindow().document.querySelector('h3').cloneNode(true);
1027
+ * document.body.append(clonedH3);
1028
+ *
1029
+ * } catch (err) {
1030
+ * console.error(err);
1031
+ * }
1032
+ * })();
1033
+ * ```
1034
+ *
1035
+ * Rendering on a child window via a library (in this example we are using the [lit-html](https://lit-html.polymer-project.org/)
1036
+ * template library to render content on a blank child window. You are not going to be able to copy paste this example without
1037
+ * configuring the project correctly but this would demonstrate some templating options available):
1038
+ * ```js
1039
+ * (async ()=> {
1040
+ * try {
1041
+ * const win = await fin.Window.create({
1042
+ * name: `child-window-${Date.now()}`,
1043
+ * url: 'about:blank'
1044
+ * });
1045
+ * const template = html`
1046
+ * <div>
1047
+ * <span>Click here: </span>
1048
+ * <button @click=${()=> console.log('Hello World!')}>log to the console</button>
1049
+ * </div>`;
1050
+ * render(template, win.getWebWindow().document.body);
1051
+ *
1052
+ * } catch (err) {
1053
+ * console.error(err);
1054
+ * }
1055
+ * })();
1056
+ * ```
881
1057
  */
882
1058
  getWebWindow(): globalThis.Window;
883
1059
  /**
884
1060
  * Determines if the window is a main window.
885
- * @return {boolean}
886
- * @tutorial Window.isMainWindow
1061
+ *
1062
+ * @example
1063
+ * ```js
1064
+ * const wnd = fin.Window.getCurrentSync();
1065
+ * const isMainWnd = wnd.isMainWindow();
1066
+ * console.log('Is this a main window? ' + isMainWnd);
1067
+ * ```
887
1068
  */
888
1069
  isMainWindow(): boolean;
889
1070
  /**
890
1071
  * Determines if the window is currently showing.
891
- * @return {Promise.<boolean>}
892
- * @tutorial Window.isShowing
1072
+ *
1073
+ * @example
1074
+ * ```js
1075
+ * async function isWindowShowing() {
1076
+ * const app = await fin.Application.start({
1077
+ * name: 'myApp',
1078
+ * uuid: 'app-1',
1079
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.isShowing.html',
1080
+ * autoShow: true
1081
+ * });
1082
+ * const win = await app.getWindow();
1083
+ * return await win.isShowing();
1084
+ * }
1085
+ *
1086
+ * isWindowShowing().then(bool => console.log(bool)).catch(err => console.log(err));
1087
+ * ```
893
1088
  */
894
1089
  isShowing(): Promise<boolean>;
895
1090
  /**
896
1091
  * Maximizes the window
897
- * @return {Promise.<void>}
898
- * @tutorial Window.maximize
1092
+ *
1093
+ * @example
1094
+ * ```js
1095
+ * async function maxWindow() {
1096
+ * const app = await fin.Application.start({
1097
+ * name: 'myApp',
1098
+ * uuid: 'app-1',
1099
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.maximize.html',
1100
+ * autoShow: true
1101
+ * });
1102
+ * const win = await app.getWindow();
1103
+ * return await win.maximize();
1104
+ * }
1105
+ *
1106
+ * maxWindow().then(() => console.log('Maximized window')).catch(err => console.log(err));
1107
+ * ```
899
1108
  */
900
1109
  maximize(): Promise<void>;
901
1110
  /**
902
1111
  * Minimizes the window.
903
- * @return {Promise.<void>}
904
- * @tutorial Window.minimize
1112
+ *
1113
+ * @example
1114
+ * ```js
1115
+ * async function minWindow() {
1116
+ * const win = await fin.Window.getCurrent();
1117
+ * return await win.minimize();
1118
+ * }
1119
+ *
1120
+ * minWindow().then(() => console.log('Minimized window')).catch(err => console.log(err));
1121
+ * ```
905
1122
  */
906
1123
  minimize(): Promise<void>;
907
1124
  /**
908
1125
  * Moves the window by a specified amount.
909
- * @param { number } deltaLeft The change in the left position of the window
910
- * @param { number } deltaTop The change in the top position of the window
911
- * @return {Promise.<void>}
912
- * @tutorial Window.moveBy
1126
+ * @param deltaLeft The change in the left position of the window
1127
+ * @param deltaTop The change in the top position of the window
1128
+ *
1129
+ * @example
1130
+ * ```js
1131
+ * async function createWin() {
1132
+ * const app = await fin.Application.start({
1133
+ * name: 'myApp',
1134
+ * uuid: 'app-1',
1135
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.moveBy.html',
1136
+ * autoShow: true
1137
+ * });
1138
+ * return await app.getWindow();
1139
+ * }
1140
+ *
1141
+ * async function moveBy(left, top) {
1142
+ * const win = await createWin();
1143
+ * return await win.moveBy(left, top);
1144
+ * }
1145
+ *
1146
+ * moveBy(580, 300).then(() => console.log('Moved')).catch(err => console.log(err));
1147
+ * ```
913
1148
  */
914
1149
  moveBy(deltaLeft: number, deltaTop: number): Promise<void>;
915
1150
  /**
916
1151
  * Moves the window to a specified location.
917
- * @param { number } left The left position of the window
918
- * @param { number } top The top position of the window
919
- * @return {Promise.<void>}
920
- * @tutorial Window.moveTo
1152
+ * @param left The left position of the window
1153
+ * @param top The top position of the window
1154
+ *
1155
+ * @example
1156
+ * ```js
1157
+ * async function createWin() {
1158
+ * const app = await fin.Application.start({
1159
+ * name: 'myApp',
1160
+ * uuid: 'app-1',
1161
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.moveTo.html',
1162
+ * autoShow: true
1163
+ * });
1164
+ * return await app.getWindow();
1165
+ * }
1166
+ *
1167
+ * async function moveTo(left, top) {
1168
+ * const win = await createWin();
1169
+ * return await win.moveTo(left, top)
1170
+ * }
1171
+ *
1172
+ * moveTo(580, 300).then(() => console.log('Moved')).catch(err => console.log(err))
1173
+ * ```
921
1174
  */
922
1175
  moveTo(left: number, top: number): Promise<void>;
923
1176
  /**
924
1177
  * Resizes the window by a specified amount.
925
- * @param { number } deltaWidth The change in the width of the window
926
- * @param { number } deltaHeight The change in the height of the window
927
- * @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
1178
+ * @param deltaWidth The change in the width of the window
1179
+ * @param deltaHeight The change in the height of the window
1180
+ * @param anchor Specifies a corner to remain fixed during the resize.
928
1181
  * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
929
1182
  * If undefined, the default is "top-left"
930
- * @return {Promise.<void>}
931
- * @tutorial Window.resizeBy
1183
+ *
1184
+ * @example
1185
+ * ```js
1186
+ * async function createWin() {
1187
+ * const app = await fin.Application.start({
1188
+ * name: 'myApp',
1189
+ * uuid: 'app-1',
1190
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.resizeBy.html',
1191
+ * autoShow: true
1192
+ * });
1193
+ * return await app.getWindow();
1194
+ * }
1195
+ *
1196
+ * async function resizeBy(left, top, anchor) {
1197
+ * const win = await createWin();
1198
+ * return await win.resizeBy(left, top, anchor)
1199
+ * }
1200
+ *
1201
+ * resizeBy(580, 300, 'top-right').then(() => console.log('Resized')).catch(err => console.log(err));
1202
+ * ```
932
1203
  */
933
1204
  resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFin.AnchorType): Promise<void>;
934
1205
  /**
935
1206
  * Resizes the window to the specified dimensions.
936
- * @param { number } width The change in the width of the window
937
- * @param { number } height The change in the height of the window
938
- * @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
1207
+ * @param width The change in the width of the window
1208
+ * @param height The change in the height of the window
1209
+ * @param anchor Specifies a corner to remain fixed during the resize.
939
1210
  * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
940
1211
  * If undefined, the default is "top-left"
941
- * @return {Promise.<void>}
942
- * @tutorial Window.resizeTo
1212
+ *
1213
+ * @example
1214
+ * ```js
1215
+ * async function createWin() {
1216
+ * const app = await fin.Application.start({
1217
+ * name: 'myApp',
1218
+ * uuid: 'app-1',
1219
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.resizeTo.html',
1220
+ * autoShow: true
1221
+ * });
1222
+ * return await app.getWindow();
1223
+ * }
1224
+ *
1225
+ * async function resizeTo(left, top, anchor) {
1226
+ * const win = await createWin();
1227
+ * return await win.resizeTo(left, top, anchor);
1228
+ * }
1229
+ *
1230
+ * resizeTo(580, 300, 'top-left').then(() => console.log('Resized')).catch(err => console.log(err));
1231
+ * ```
943
1232
  */
944
1233
  resizeTo(width: number, height: number, anchor: OpenFin.AnchorType): Promise<void>;
945
1234
  /**
946
1235
  * Restores the window to its normal state (i.e., unminimized, unmaximized).
947
- * @return {Promise.<void>}
948
- * @tutorial Window.restore
1236
+ *
1237
+ * @example
1238
+ * ```js
1239
+ * async function createWin() {
1240
+ * const app = await fin.Application.start({
1241
+ * name: 'myApp',
1242
+ * uuid: 'app-1',
1243
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.restore.html',
1244
+ * autoShow: true
1245
+ * });
1246
+ * return await app.getWindow();
1247
+ * }
1248
+ *
1249
+ * async function restore() {
1250
+ * const win = await createWin();
1251
+ * return await win.restore();
1252
+ * }
1253
+ *
1254
+ * restore().then(() => console.log('Restored')).catch(err => console.log(err));
1255
+ * ```
949
1256
  */
950
1257
  restore(): Promise<void>;
951
1258
  /**
952
1259
  * Will bring the window to the front of the entire stack and give it focus.
953
- * @return {Promise.<void>}
954
- * @tutorial Window.setAsForeground
1260
+ *
1261
+ * @example
1262
+ * ```js
1263
+ * async function createWin() {
1264
+ * const app = await fin.Application.start({
1265
+ * name: 'myApp',
1266
+ * uuid: 'app-1',
1267
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setAsForeground.html',
1268
+ * autoShow: true
1269
+ * });
1270
+ * return await app.getWindow();
1271
+ * }
1272
+ *
1273
+ * async function setAsForeground() {
1274
+ * const win = await createWin();
1275
+ * return await win.setAsForeground()
1276
+ * }
1277
+ *
1278
+ * setAsForeground().then(() => console.log('In the foreground')).catch(err => console.log(err));
1279
+ * ```
955
1280
  */
956
1281
  setAsForeground(): Promise<void>;
957
1282
  /**
958
1283
  * Sets the window's size and position.
959
1284
  * @property { Bounds } bounds This is a * @type {string} name - name of the window.object that holds the propertys of
960
- * @return {Promise.<void>}
961
- * @tutorial Window.setBounds
1285
+ *
1286
+ * @example
1287
+ * ```js
1288
+ * async function createWin() {
1289
+ * const app = await fin.Application.start({
1290
+ * name: 'myApp',
1291
+ * uuid: 'app-1',
1292
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setBounds.html',
1293
+ * autoShow: true
1294
+ * });
1295
+ * return await app.getWindow();
1296
+ * }
1297
+ *
1298
+ * async function setBounds(bounds) {
1299
+ * const win = await createWin();
1300
+ * return await win.setBounds(bounds);
1301
+ * }
1302
+ *
1303
+ * setBounds({
1304
+ * height: 100,
1305
+ * width: 200,
1306
+ * top: 400,
1307
+ * left: 400
1308
+ * }).then(() => console.log('Bounds set to window')).catch(err => console.log(err));
1309
+ * ```
962
1310
  */
963
1311
  setBounds(bounds: Partial<OpenFin.Bounds>): Promise<void>;
964
1312
  /**
965
1313
  * Shows the window if it is hidden.
966
- * @param { boolean } [force = false] Show will be prevented from showing when force is false and
1314
+ * @param force Show will be prevented from showing when force is false and
967
1315
  * ‘show-requested’ has been subscribed to for application’s main window.
968
- * @return {Promise.<void>}
969
- * @tutorial Window.show
1316
+ *
1317
+ * @example
1318
+ * ```js
1319
+ * async function createWin() {
1320
+ * const app = await fin.Application.start({
1321
+ * name: 'myApp',
1322
+ * uuid: 'app-1',
1323
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.show.html',
1324
+ * autoShow: false
1325
+ * });
1326
+ * return await app.getWindow();
1327
+ * }
1328
+ *
1329
+ * async function show() {
1330
+ * const win = await createWin();
1331
+ * return await win.show()
1332
+ * }
1333
+ *
1334
+ * show().then(() => console.log('Showing')).catch(err => console.log(err));
1335
+ * ```
970
1336
  */
971
1337
  show(force?: boolean): Promise<void>;
972
1338
  /**
973
1339
  * Shows the window if it is hidden at the specified location.
974
1340
  * If the toggle parameter is set to true, the window will
975
1341
  * alternate between showing and hiding.
976
- * @param { number } left The left position of the window
977
- * @param { number } top The right position of the window
978
- * @param { boolean } force Show will be prevented from closing when force is false and
1342
+ * @param left The left position of the window
1343
+ * @param top The right position of the window
1344
+ * @param force Show will be prevented from closing when force is false and
979
1345
  * ‘show-requested’ has been subscribed to for application’s main window
980
- * @return {Promise.<void>}
981
- * @tutorial Window.showAt
1346
+ *
1347
+ * @example
1348
+ * ```js
1349
+ * async function createWin() {
1350
+ * const app = await fin.Application.start({
1351
+ * name: 'myApp',
1352
+ * uuid: 'app-1',
1353
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.showAt.html',
1354
+ * autoShow: true
1355
+ * });
1356
+ * return await app.getWindow();
1357
+ * }
1358
+ *
1359
+ * async function showAt(left, top) {
1360
+ * const win = await createWin();
1361
+ * return await win.showAt(left, top)
1362
+ * }
1363
+ *
1364
+ * showAt(580, 300).then(() => console.log('Showing at')).catch(err => console.log(err));
1365
+ * ```
982
1366
  */
983
1367
  showAt(left: number, top: number, force?: boolean): Promise<void>;
984
1368
  /**
985
1369
  * Shows the Chromium Developer Tools
986
- * @return {Promise.<void>}
1370
+ *
987
1371
  * @tutorial Window.showDeveloperTools
988
1372
  */
989
1373
  /**
990
1374
  * Updates the window using the passed options.
991
- * Values that are objects are deep-merged, overwriting only the values that are provided.
992
- * @param {*} options Changes a window's options that were defined upon creation. See tutorial
993
- * @return {Promise.<void>}
994
- * @tutorial Window.updateOptions
1375
+ *
1376
+ * @remarks Values that are objects are deep-merged, overwriting only the values that are provided.
1377
+ * @param options Changes a window's options that were defined upon creation. See tutorial
1378
+ *
1379
+ * @example
1380
+ * ```js
1381
+ * async function updateOptions() {
1382
+ * const win = await fin.Window.getCurrent();
1383
+ * return win.updateOptions({maxWidth: 100});
1384
+ * }
1385
+ * updateOptions().then(() => console.log('options is updated')).catch(err => console.error(err));
1386
+ * ```
995
1387
  */
996
1388
  updateOptions(options: OpenFin.UpdatableWindowOptions): Promise<void>;
997
1389
  /**
998
1390
  * Provides credentials to authentication requests
999
- * @param { string } userName userName to provide to the authentication challenge
1000
- * @param { string } password password to provide to the authentication challenge
1001
- * @return {Promise.<void>}
1002
- * @tutorial Window.authenticate
1391
+ * @param userName userName to provide to the authentication challenge
1392
+ * @param password password to provide to the authentication challenge
1393
+ *
1394
+ * @example
1395
+ * ```js
1396
+ * fin.Application.wrap({uuid: 'OpenfinPOC'}).then(app => {
1397
+ * app.on('window-auth-requested', evt => {
1398
+ * let win = fin.Window.wrap({ uuid: evt.uuid, name: evt.name});
1399
+ * win.authenticate('userName', 'P@assw0rd').then(()=> console.log('authenticated')).catch(err => console.log(err));
1400
+ * });
1401
+ * });
1402
+ * ```
1003
1403
  */
1004
1404
  authenticate(userName: string, password: string): Promise<void>;
1005
1405
  /**
@@ -1025,20 +1425,95 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
1025
1425
  * @property {* | undefined} [data] - The data property of the menu item clicked by the user. Only defined if result was `clicked`.
1026
1426
  */
1027
1427
  /**
1028
- * Shows a menu on the window. Returns a promise that resolves when the user has either selected an item or closed the menu. (This may take longer than other apis).
1428
+ * Shows a menu on the window.
1429
+ *
1430
+ * @remarks Returns a promise that resolves when the user has either selected an item or closed the menu. (This may take longer than other apis).
1029
1431
  * Resolves to an object with `{result: 'clicked', data }` where data is the data field on the menu item clicked, or `{result 'closed'}` when the user doesn't select anything.
1030
1432
  * Calling this method will close previously opened menus.
1031
1433
  * @experimental
1032
- * @param {ShowPopupMenuOptions} options
1033
- * @return {Promise<MenuResult>}
1034
- * @tutorial Window.showPopupMenu
1434
+ * @param options
1435
+ *
1436
+ * @example
1437
+ * This could be used to show a drop down menu over views in a platform window:
1438
+ * ```js
1439
+ * const template = [
1440
+ * {
1441
+ * label: 'Menu Item 1',
1442
+ * data: 'hello from item 1'
1443
+ * },
1444
+ * { type: 'separator' },
1445
+ * {
1446
+ * label: 'Menu Item 2',
1447
+ * type: 'checkbox',
1448
+ * checked: true,
1449
+ * data: 'The user clicked the checkbox'
1450
+ * },
1451
+ * {
1452
+ * label: 'see more',
1453
+ * enabled: false,
1454
+ * submenu: [
1455
+ * { label: 'submenu 1', data: 'hello from submenu' }
1456
+ * ]
1457
+ * }
1458
+ * ]
1459
+ * fin.me.showPopupMenu({ template }).then(r => {
1460
+ * if (r.result === 'closed') {
1461
+ * console.log('nothing happened');
1462
+ * } else {
1463
+ * console.log(r.data)
1464
+ * }
1465
+ * })
1466
+ * ```
1467
+ *
1468
+ * Overriding the built in context menu (ote that this can be done per element or document wide):
1469
+ * ```js
1470
+ * document.addEventListener('contextmenu', e => {
1471
+ * e.preventDefault();
1472
+ * const template = [
1473
+ * {
1474
+ * label: 'Menu Item 1',
1475
+ * data: 'hello from item 1'
1476
+ * },
1477
+ * { type: 'separator' },
1478
+ * {
1479
+ * label: 'Menu Item 2',
1480
+ * type: 'checkbox',
1481
+ * checked: true,
1482
+ * data: 'The user clicked the checkbox'
1483
+ * },
1484
+ * {
1485
+ * label: 'see more',
1486
+ * enabled: false,
1487
+ * submenu: [
1488
+ * { label: 'submenu 1', data: 'hello from submenu' }
1489
+ * ]
1490
+ * }
1491
+ * ]
1492
+ * fin.me.showPopupMenu({ template, x: e.x, y: e.y }).then(r => {
1493
+ * if (r.result === 'closed') {
1494
+ * console.log('nothing happened');
1495
+ * } else {
1496
+ * console.log(r.data)
1497
+ * }
1498
+ * })
1499
+ * })
1500
+ * ```
1035
1501
  */
1036
1502
  showPopupMenu<T>(options: OpenFin.ShowPopupMenuOptions<T>): Promise<OpenFin.MenuResult<T>>;
1037
1503
  /**
1038
1504
  * Closes the window's popup menu, if one exists.
1039
1505
  * @experimental
1040
- * @return {Promise<void>}
1041
- * @tutorial Window.closePopupMenu
1506
+ *
1507
+ * @remarks Only one popup menu will ever be showing at a time. Calling `showPopupMenu` will automatically close
1508
+ * any existing popup menu.
1509
+ *
1510
+ *
1511
+ * @example
1512
+ * This could be used to close a popup menu if the user's mouse leaves an element for example.
1513
+ *
1514
+ * ```js
1515
+ * await fin.me.closePopupMenu();
1516
+ * ```
1042
1517
  */
1043
1518
  closePopupMenu(): Promise<void>;
1044
1519
  /**
@@ -1065,26 +1540,59 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
1065
1540
  * @property {* | undefined} [data] - Data passed to `dispatchPopupResult`.
1066
1541
  */
1067
1542
  /**
1068
- * Shows a popup window. If this window currently has a popup open, closes it.
1069
- * @function showPopupWindow
1070
- * @memberOf Window
1071
- * @instance
1072
- * @param {PopupOptions} options
1073
- * @return {Promise<PopupResult>}
1074
- * @tutorial Window.showPopupWindow
1075
- */
1076
- /**
1077
- * Dispatch a result to the caller of `showPopupWindow`. If this window isn't currently being shown as a popup, this call will silently fail.
1078
- * @param {*} data Serializable data to send to the caller window.
1079
- * @return {Promise<void>}
1080
- * @tutorial Window.dispatchPopupResult
1543
+ * Dispatch a result to the caller of `showPopupWindow`.
1544
+ *
1545
+ * @remarks If this window isn't currently being shown as a popup, this call will silently fail.
1546
+ * @param data Serializable data to send to the caller window.
1547
+ *
1548
+ * @example
1549
+ * ```js
1550
+ * await fin.me.dispatchPopupResult({
1551
+ * foo: 'bar'
1552
+ * });
1553
+ * ```
1081
1554
  */
1082
1555
  dispatchPopupResult(data: any): Promise<void>;
1083
1556
  /**
1084
1557
  * Prints the contents of the window.
1085
1558
  *
1086
1559
  * @param options Configuration for the print task.
1087
- * @tutorial Window.print
1560
+ * @remarks When `silent` is set to `true`, the API will pick the system's default printer if deviceName is empty
1561
+ * and the default settings for printing.
1562
+ *
1563
+ * Use the CSS style `page-break-before: always;` to force print to a new page.
1564
+ *
1565
+ * @example
1566
+ * ```js
1567
+ * const win = fin.Window.getCurrentSync();
1568
+ *
1569
+ * win.print({ silent: false, deviceName: 'system-printer-name' }).then(() => {
1570
+ * console.log('print call has been sent to the system');
1571
+ * });
1572
+ * ```
1573
+ *
1574
+ * If a window has embedded views, those views will not print by default. To print a window's contents including embedded views,
1575
+ * use the `content` option:
1576
+ *
1577
+ * ```js
1578
+ * const win = fin.Window.getCurrentSync();
1579
+ *
1580
+ * // Print embedded views
1581
+ * win.print({ content: 'views' });
1582
+ *
1583
+ * // Print screenshot of current window
1584
+ * win.print({ content: 'screenshot' })
1585
+ * ```
1586
+ *
1587
+ * When `content` is set to `views`, the embedded views in the platform window will be concatenated and printed as
1588
+ * individual pages. If `includeSelf` is set to `true`, the platform window itself will be printed as the first
1589
+ * page - be aware that this page will *not* include the embedded views - it will only include the contents of
1590
+ * the platform window itself (e.g. tab stacks), with blank spaces where the view contents would be embedded.
1591
+ *
1592
+ * Due to a known issue, view contents that are not visible at the time `print` is called will not appear when
1593
+ * printing `contents: views`. This includes views that are obscured behind other active UI elements.
1594
+ *
1595
+ * To print the views embedded in their page context, set `content` to `screenshot`.
1088
1596
  */
1089
1597
  print(options?: OpenFin.WindowPrintOptions): Promise<void>;
1090
1598
  }