@openfin/core 33.76.31 → 33.76.38

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 (269) hide show
  1. package/OpenFin.d.ts +1 -1
  2. package/README.md +29 -4
  3. package/fin.d.ts +2 -2
  4. package/{src → out}/GlobalOpenFin.d.ts +1 -1
  5. package/out/mock-alpha.d.ts +16112 -0
  6. package/out/mock-beta.d.ts +16112 -0
  7. package/out/mock-public.d.ts +16112 -0
  8. package/out/mock.d.ts +16797 -0
  9. package/out/mock.js +17104 -0
  10. package/package.json +30 -23
  11. package/LICENSE +0 -13
  12. package/NOTICE +0 -16
  13. package/openfin-core-33.76.31.tgz +0 -0
  14. package/src/OpenFin.d.ts +0 -3080
  15. package/src/OpenFin.js +0 -2
  16. package/src/api/api-exposer/api-consumer.d.ts +0 -28
  17. package/src/api/api-exposer/api-consumer.js +0 -28
  18. package/src/api/api-exposer/api-exposer.d.ts +0 -35
  19. package/src/api/api-exposer/api-exposer.js +0 -38
  20. package/src/api/api-exposer/decorators.d.ts +0 -10
  21. package/src/api/api-exposer/decorators.js +0 -18
  22. package/src/api/api-exposer/index.d.ts +0 -4
  23. package/src/api/api-exposer/index.js +0 -20
  24. package/src/api/api-exposer/strategies/index.d.ts +0 -1
  25. package/src/api/api-exposer/strategies/index.js +0 -17
  26. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
  27. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
  28. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
  29. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
  30. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
  31. package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
  32. package/src/api/application/Factory.d.ts +0 -148
  33. package/src/api/application/Factory.js +0 -230
  34. package/src/api/application/Instance.d.ts +0 -321
  35. package/src/api/application/Instance.js +0 -453
  36. package/src/api/application/index.d.ts +0 -3
  37. package/src/api/application/index.js +0 -19
  38. package/src/api/base.d.ts +0 -48
  39. package/src/api/base.js +0 -177
  40. package/src/api/clipboard/index.d.ts +0 -92
  41. package/src/api/clipboard/index.js +0 -120
  42. package/src/api/events/application.d.ts +0 -146
  43. package/src/api/events/application.js +0 -2
  44. package/src/api/events/base.d.ts +0 -42
  45. package/src/api/events/base.js +0 -2
  46. package/src/api/events/channel.d.ts +0 -30
  47. package/src/api/events/channel.js +0 -2
  48. package/src/api/events/emitterMap.d.ts +0 -11
  49. package/src/api/events/emitterMap.js +0 -35
  50. package/src/api/events/eventAggregator.d.ts +0 -5
  51. package/src/api/events/eventAggregator.js +0 -35
  52. package/src/api/events/externalApplication.d.ts +0 -19
  53. package/src/api/events/externalApplication.js +0 -2
  54. package/src/api/events/frame.d.ts +0 -30
  55. package/src/api/events/frame.js +0 -2
  56. package/src/api/events/globalHotkey.d.ts +0 -20
  57. package/src/api/events/globalHotkey.js +0 -2
  58. package/src/api/events/platform.d.ts +0 -26
  59. package/src/api/events/platform.js +0 -2
  60. package/src/api/events/system.d.ts +0 -113
  61. package/src/api/events/system.js +0 -2
  62. package/src/api/events/typedEventEmitter.d.ts +0 -20
  63. package/src/api/events/typedEventEmitter.js +0 -2
  64. package/src/api/events/view.d.ts +0 -82
  65. package/src/api/events/view.js +0 -2
  66. package/src/api/events/webcontents.d.ts +0 -266
  67. package/src/api/events/webcontents.js +0 -2
  68. package/src/api/events/window.d.ts +0 -352
  69. package/src/api/events/window.js +0 -2
  70. package/src/api/external-application/Factory.d.ts +0 -27
  71. package/src/api/external-application/Factory.js +0 -40
  72. package/src/api/external-application/Instance.d.ts +0 -102
  73. package/src/api/external-application/Instance.js +0 -109
  74. package/src/api/external-application/index.d.ts +0 -3
  75. package/src/api/external-application/index.js +0 -19
  76. package/src/api/fin.d.ts +0 -51
  77. package/src/api/fin.js +0 -42
  78. package/src/api/frame/Factory.d.ts +0 -37
  79. package/src/api/frame/Factory.js +0 -69
  80. package/src/api/frame/Instance.d.ts +0 -123
  81. package/src/api/frame/Instance.js +0 -130
  82. package/src/api/frame/index.d.ts +0 -3
  83. package/src/api/frame/index.js +0 -19
  84. package/src/api/global-hotkey/index.d.ts +0 -38
  85. package/src/api/global-hotkey/index.js +0 -64
  86. package/src/api/interappbus/channel/channel.d.ts +0 -28
  87. package/src/api/interappbus/channel/channel.js +0 -77
  88. package/src/api/interappbus/channel/channels-docs.d.ts +0 -340
  89. package/src/api/interappbus/channel/channels-docs.js +0 -398
  90. package/src/api/interappbus/channel/client.d.ts +0 -24
  91. package/src/api/interappbus/channel/client.js +0 -89
  92. package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
  93. package/src/api/interappbus/channel/connection-manager.js +0 -246
  94. package/src/api/interappbus/channel/index.d.ts +0 -25
  95. package/src/api/interappbus/channel/index.js +0 -169
  96. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
  97. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
  98. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
  99. package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
  100. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
  101. package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
  102. package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
  103. package/src/api/interappbus/channel/protocols/index.js +0 -2
  104. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
  105. package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
  106. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
  107. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
  108. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
  109. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
  110. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
  111. package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
  112. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
  113. package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
  114. package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
  115. package/src/api/interappbus/channel/protocols/strategy.js +0 -2
  116. package/src/api/interappbus/channel/provider.d.ts +0 -34
  117. package/src/api/interappbus/channel/provider.js +0 -166
  118. package/src/api/interappbus/index.d.ts +0 -85
  119. package/src/api/interappbus/index.js +0 -175
  120. package/src/api/interop/Factory.d.ts +0 -37
  121. package/src/api/interop/Factory.js +0 -76
  122. package/src/api/interop/InteropBroker.d.ts +0 -437
  123. package/src/api/interop/InteropBroker.js +0 -1085
  124. package/src/api/interop/InteropClient.d.ts +0 -278
  125. package/src/api/interop/InteropClient.js +0 -459
  126. package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
  127. package/src/api/interop/SessionContextGroupBroker.js +0 -108
  128. package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
  129. package/src/api/interop/SessionContextGroupClient.js +0 -86
  130. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
  131. package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
  132. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
  133. package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
  134. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -208
  135. package/src/api/interop/fdc3/fdc3-1.2.js +0 -438
  136. package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -301
  137. package/src/api/interop/fdc3/fdc3-2.0.js +0 -482
  138. package/src/api/interop/fdc3/fdc3.d.ts +0 -12
  139. package/src/api/interop/fdc3/fdc3.js +0 -35
  140. package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
  141. package/src/api/interop/fdc3/overrideCheck.js +0 -32
  142. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
  143. package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
  144. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
  145. package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
  146. package/src/api/interop/fdc3/utils.d.ts +0 -45
  147. package/src/api/interop/fdc3/utils.js +0 -239
  148. package/src/api/interop/fdc3/versions.d.ts +0 -1
  149. package/src/api/interop/fdc3/versions.js +0 -2
  150. package/src/api/interop/index.d.ts +0 -4
  151. package/src/api/interop/index.js +0 -20
  152. package/src/api/interop/utils.d.ts +0 -18
  153. package/src/api/interop/utils.js +0 -61
  154. package/src/api/me.d.ts +0 -40
  155. package/src/api/me.js +0 -134
  156. package/src/api/platform/Factory.d.ts +0 -115
  157. package/src/api/platform/Factory.js +0 -184
  158. package/src/api/platform/Instance.d.ts +0 -150
  159. package/src/api/platform/Instance.js +0 -332
  160. package/src/api/platform/common-utils.d.ts +0 -7
  161. package/src/api/platform/common-utils.js +0 -16
  162. package/src/api/platform/index.d.ts +0 -3
  163. package/src/api/platform/index.js +0 -19
  164. package/src/api/platform/layout/Factory.d.ts +0 -114
  165. package/src/api/platform/layout/Factory.js +0 -174
  166. package/src/api/platform/layout/Instance.d.ts +0 -57
  167. package/src/api/platform/layout/Instance.js +0 -126
  168. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
  169. package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
  170. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
  171. package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
  172. package/src/api/platform/layout/entities/layout-entities.d.ts +0 -235
  173. package/src/api/platform/layout/entities/layout-entities.js +0 -312
  174. package/src/api/platform/layout/entities/shapes.d.ts +0 -6
  175. package/src/api/platform/layout/entities/shapes.js +0 -2
  176. package/src/api/platform/layout/index.d.ts +0 -2
  177. package/src/api/platform/layout/index.js +0 -18
  178. package/src/api/platform/layout/layout.constants.d.ts +0 -1
  179. package/src/api/platform/layout/layout.constants.js +0 -4
  180. package/src/api/platform/layout/shapes.d.ts +0 -16
  181. package/src/api/platform/layout/shapes.js +0 -2
  182. package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
  183. package/src/api/platform/layout/utils/layout-traversal.js +0 -65
  184. package/src/api/platform/provider.d.ts +0 -163
  185. package/src/api/platform/provider.js +0 -2
  186. package/src/api/snapshot-source/Factory.d.ts +0 -38
  187. package/src/api/snapshot-source/Factory.js +0 -66
  188. package/src/api/snapshot-source/Instance.d.ts +0 -31
  189. package/src/api/snapshot-source/Instance.js +0 -132
  190. package/src/api/snapshot-source/index.d.ts +0 -3
  191. package/src/api/snapshot-source/index.js +0 -19
  192. package/src/api/snapshot-source/utils.d.ts +0 -2
  193. package/src/api/snapshot-source/utils.js +0 -6
  194. package/src/api/system/index.d.ts +0 -517
  195. package/src/api/system/index.js +0 -895
  196. package/src/api/view/Factory.d.ts +0 -50
  197. package/src/api/view/Factory.js +0 -103
  198. package/src/api/view/Instance.d.ts +0 -487
  199. package/src/api/view/Instance.js +0 -557
  200. package/src/api/view/index.d.ts +0 -3
  201. package/src/api/view/index.js +0 -19
  202. package/src/api/webcontents/main.d.ts +0 -32
  203. package/src/api/webcontents/main.js +0 -156
  204. package/src/api/window/Factory.d.ts +0 -45
  205. package/src/api/window/Factory.js +0 -91
  206. package/src/api/window/Instance.d.ts +0 -1090
  207. package/src/api/window/Instance.js +0 -1349
  208. package/src/api/window/index.d.ts +0 -3
  209. package/src/api/window/index.js +0 -19
  210. package/src/browser.d.ts +0 -10
  211. package/src/browser.js +0 -36
  212. package/src/environment/browser.d.ts +0 -29
  213. package/src/environment/browser.js +0 -60
  214. package/src/environment/environment.d.ts +0 -33
  215. package/src/environment/environment.js +0 -4
  216. package/src/environment/mockEnvironment.d.ts +0 -27
  217. package/src/environment/mockEnvironment.js +0 -61
  218. package/src/environment/node-env.d.ts +0 -29
  219. package/src/environment/node-env.js +0 -72
  220. package/src/fdc3.d.ts +0 -3
  221. package/src/fdc3.js +0 -9
  222. package/src/mock.d.ts +0 -3
  223. package/src/mock.js +0 -18
  224. package/src/namespaces.d.ts +0 -21
  225. package/src/namespaces.js +0 -24
  226. package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
  227. package/src/shapes/ERROR_BOX_TYPES.js +0 -2
  228. package/src/shapes/WebOptions.d.ts +0 -13
  229. package/src/shapes/WebOptions.js +0 -2
  230. package/src/shapes/WindowOptions.d.ts +0 -43
  231. package/src/shapes/WindowOptions.js +0 -2
  232. package/src/shapes/protocol.d.ts +0 -200
  233. package/src/shapes/protocol.js +0 -2
  234. package/src/transport/mockWire.d.ts +0 -11
  235. package/src/transport/mockWire.js +0 -26
  236. package/src/transport/transport-errors.d.ts +0 -31
  237. package/src/transport/transport-errors.js +0 -79
  238. package/src/transport/transport.d.ts +0 -73
  239. package/src/transport/transport.js +0 -219
  240. package/src/transport/wire.d.ts +0 -77
  241. package/src/transport/wire.js +0 -36
  242. package/src/util/asyncFilter.d.ts +0 -1
  243. package/src/util/asyncFilter.js +0 -7
  244. package/src/util/channel-api-relay.d.ts +0 -13
  245. package/src/util/channel-api-relay.js +0 -47
  246. package/src/util/errors.d.ts +0 -10
  247. package/src/util/errors.js +0 -12
  248. package/src/util/exhaustive.d.ts +0 -1
  249. package/src/util/exhaustive.js +0 -7
  250. package/src/util/http.d.ts +0 -11
  251. package/src/util/http.js +0 -90
  252. package/src/util/inaccessibleObject.d.ts +0 -2
  253. package/src/util/inaccessibleObject.js +0 -49
  254. package/src/util/lazy.d.ts +0 -34
  255. package/src/util/lazy.js +0 -54
  256. package/src/util/normalize-config.d.ts +0 -3
  257. package/src/util/normalize-config.js +0 -52
  258. package/src/util/promises.d.ts +0 -5
  259. package/src/util/promises.js +0 -27
  260. package/src/util/ref-counter.d.ts +0 -7
  261. package/src/util/ref-counter.js +0 -52
  262. package/src/util/reversible-map.d.ts +0 -11
  263. package/src/util/reversible-map.js +0 -49
  264. package/src/util/runtimeVersioning.d.ts +0 -3
  265. package/src/util/runtimeVersioning.js +0 -25
  266. package/src/util/utilTypes.d.ts +0 -8
  267. package/src/util/utilTypes.js +0 -2
  268. package/src/util/validate.d.ts +0 -3
  269. package/src/util/validate.js +0 -11
@@ -1,1349 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._Window = void 0;
4
- /* eslint-disable import/prefer-default-export */
5
- /* eslint-disable @typescript-eslint/no-unused-vars */
6
- /* eslint-disable no-console */
7
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
8
- const application_1 = require("../application");
9
- const main_1 = require("../webcontents/main");
10
- const view_1 = require("../view");
11
- /**
12
- * @PORTED
13
- * @typedef { object } Margins
14
- * @property { string } [marginType]
15
- * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
16
- * you will also need to specify `top`, `bottom`, `left`, and `right`.
17
- *
18
- * @property { number } [top] The top margin of the printed web page, in pixels.
19
- * @property { number } [bottom] The bottom margin of the printed web page, in pixels.
20
- * @property { number } [left] The left margin of the printed web page, in pixels.
21
- * @property { number } [right] The right margin of the printed web page, in pixels.
22
- */
23
- /**
24
- * @PORTED
25
- * @typedef { object } Dpi
26
- * @property { number } [horizontal] The horizontal dpi
27
- * @property { number } [vertical] The vertical dpi
28
- */
29
- /**
30
- * @PORTED
31
- * @typedef { object } PrintOptions
32
- * @property { boolean } [silent=false] Don't ask user for print settings.
33
- * @property { boolean } [printBackground=false] Prints the background color and image of the web page.
34
- * @property { string } [deviceName=''] Set the printer device name to use.
35
- * @property { boolean } [color=true] Set whether the printed web page will be in color or grayscale.
36
- * @property { Margins } [margins] Set margins for the printed web page
37
- * @property { boolean } [landscape=false] Whether the web page should be printed in landscape mode.
38
- * @property { number } [scaleFactor] The scale factor of the web page.
39
- * @property { number } [pagesPerSheet] The number of pages to print per page sheet.
40
- * @property { boolean } [collate] Whether the web page should be collated.
41
- * @property { number } [copies] The number of copies of the web page to print.
42
- * @property { Record<string, number> } [pageRanges] The page range to print. Should have two keys: from and to.
43
- * @property { string } [duplexMode] Set the duplex mode of the printed web page. Can be simplex, shortEdge, or longEdge.
44
- * @property { Dpi } [dpi] Set dpi for the printed web page
45
- */
46
- /**
47
- * @REMOVED
48
- * PrinterInfo interface
49
- * @typedef { object } PrinterInfo
50
- * @property { string } name Printer Name
51
- * @property { string } description Printer Description
52
- * @property { number } status Printer Status
53
- * @property { boolean } isDefault Indicates that system's default printer
54
- */
55
- /**
56
- * @REMOVED
57
- * SharedWorkerInfo interface
58
- * @typedef { object } SharedWorkerInfo
59
- * @property { string } id The unique id of the shared worker.
60
- * @property { string } url The url of the shared worker.
61
- */
62
- /**
63
- * @PORTED
64
- * ContentCreationRule interface
65
- * @typedef { object } ContentCreationRule
66
- * @property { string } behavior 'view' | 'window' | 'browser' | 'block'
67
- * @property { string[] } match List of [match patterns](https://developer.chrome.com/extensions/match_patterns).
68
- * @property { object } options Window creation options or View creation options.
69
- */
70
- /**
71
- * @PORTED
72
- * @typedef {object} Window~options
73
- * @summary Window creation options.
74
- * @desc This is the options object required by {@link Window.create Window.create}.
75
- *
76
- * Note that `name` is the only required property — albeit the `url` property is usually provided as well
77
- * (defaults to `"about:blank"` when omitted).
78
- *
79
- * _This jsdoc typedef mirrors the `WindowOptions` TypeScript interface in `@types/openfin`._
80
- *
81
- * @property {object} [accelerator]
82
- * Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache.
83
- *
84
- * @property {boolean} [accelerator.devtools=false]
85
- * If `true`, enables the devtools keyboard shortcut:<br>
86
- * `Ctrl` + `Shift` + `I` _(Toggles Devtools)_
87
- *
88
- * @property {boolean} [accelerator.reload=false]
89
- * If `true`, enables the reload keyboard shortcuts:<br>
90
- * `Ctrl` + `R` _(Windows)_<br>
91
- * `F5` _(Windows)_<br>
92
- * `Command` + `R` _(Mac)_
93
- *
94
- * @property {boolean} [accelerator.reloadIgnoringCache=false]
95
- * If `true`, enables the reload-from-source keyboard shortcuts:<br>
96
- * `Ctrl` + `Shift` + `R` _(Windows)_<br>
97
- * `Shift` + `F5` _(Windows)_<br>
98
- * `Command` + `Shift` + `R` _(Mac)_
99
- *
100
- * @property {boolean} [accelerator.zoom=false]
101
- * NOTE: It is not recommended to set this value to true for Windows in Platforms as that may lead to unexpected visual shifts in layout.
102
- * If `true`, enables the zoom keyboard shortcuts:<br>
103
- * `Ctrl` + `+` _(Zoom In)_<br>
104
- * `Ctrl` + `Shift` + `+` _(Zoom In)_<br>
105
- * `Ctrl` + `NumPad+` _(Zoom In)_<br>
106
- * `Ctrl` + `-` _(Zoom Out)_<br>
107
- * `Ctrl` + `Shift` + `-` _(Zoom Out)_<br>
108
- * `Ctrl` + `NumPad-` _(Zoom Out)_<br>
109
- * `Ctrl` + `Scroll` _(Zoom In & Out)_<br>
110
- * `Ctrl` + `0` _(Restore to 100%)_
111
- *
112
- * @property {object} [alphaMask] - _Experimental._ _Updatable._
113
- * <br>
114
- * alphaMask turns anything of matching RGB value transparent.
115
- * <br>
116
- * Caveats:
117
- * * runtime key --disable-gpu is required. Note: Unclear behavior on remote Desktop support
118
- * * User cannot click-through transparent regions
119
- * * Not supported on Mac
120
- * * Windows Aero must be enabled
121
- * * Won't make visual sense on Pixel-pushed environments such as Citrix
122
- * * Not supported on rounded corner windows
123
- * @property {number} [alphaMask.red=-1] 0-255
124
- * @property {number} [alphaMask.green=-1] 0-255
125
- * @property {number} [alphaMask.blue=-1] 0-255
126
- *
127
- * @property {boolean} [alwaysOnTop=false] - _Updatable._
128
- * A flag to always position the window at the top of the window stack.
129
- *
130
- * @property {object} [api]
131
- * Configurations for API injection.
132
- *
133
- * @property {object} [api.iframe] Configure if the the API should be injected into iframes based on domain.
134
- *
135
- * @property {boolean} [api.iframe.crossOriginInjection=false] Controls if the `fin` API object is present for cross origin iframes.
136
- * @property {boolean} [api.iframe.sameOriginInjection=true] Controls if the `fin` API object is present for same origin iframes.
137
- *
138
- * @property {string} [applicationIcon = ""] - _Deprecated_ - use `icon` instead.
139
- *
140
- * @property {number} [aspectRatio=0] - _Updatable._
141
- * The aspect ratio of width to height to enforce for the window. If this value is equal to or less than zero,
142
- * an aspect ratio will not be enforced.
143
- *
144
- * @property {string} [autoplayPolicy="no-user-gesture-required"]
145
- * Autoplay policy to apply to content in the window, can be
146
- * `no-user-gesture-required`, `user-gesture-required`,
147
- * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
148
- *
149
- * @property {boolean} [autoShow=true]
150
- * A flag to automatically show the window when it is created.
151
- *
152
- * @property {string} [backgroundColor="#FFF"]
153
- * The window’s _backfill_ color as a hexadecimal value. Not to be confused with the content background color
154
- * (`document.body.style.backgroundColor`),
155
- * this color briefly fills a window’s (a) content area before its content is loaded as well as (b) newly exposed
156
- * areas when growing a window. Setting
157
- * this value to the anticipated content background color can help improve user experience.
158
- * Default is white.
159
- *
160
- * @property {object} [contentCreation]
161
- * Apply rules that determine how user interaction (`window.open` and links) creates content.
162
- * @property {ContentCreationRule[]} [contentCreation.rules = []] List of content creation rules.
163
- *
164
- * @property {object} [contentNavigation]
165
- * Restrict navigation to URLs that match an allowed pattern.
166
- * In the lack of an allowlist, navigation to URLs that match a denied pattern would be prohibited.
167
- * See [here](https://developer.chrome.com/extensions/match_patterns) for more details.
168
- * @property {string[]} [contentNavigation.allowlist=[]] List of allowed URLs.
169
- * @property {string[]} [contentNavigation.denylist=[]] List of denied URLs.
170
- *
171
- * @property {object} [contentRedirect]
172
- * Restrict redirects to URLs that match an allowed pattern.
173
- * In the lack of an allowlist, redirects to URLs that match a denied pattern would be prohibited.
174
- * See [here](https://developer.chrome.com/extensions/match_patterns) for more details.
175
- * @property {string[]} [contentRedirect.allowlist=[]] List of allowed URLs.
176
- * @property {string[]} [contentRedirect.denylist=[]] List of denied URLs.
177
- *
178
- * @property {boolean} [contextMenu=true] - _Updatable._
179
- * A flag to show the context menu when right-clicking on a window.
180
- * Gives access to the devtools for the window.
181
- *
182
- * @property {object} [contextMenuSettings] - _Updatable._
183
- * Deprecated - superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax.
184
- * Configure the context menu when right-clicking on a window.
185
- * @property {boolean} [contextMenuSettings.enable=true] Should the context menu display on right click.
186
- * @property {boolean} [contextMenuSettings.devtools=true] Should the context menu contain a button for opening devtools.
187
- * @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
188
- *
189
- * @property {object} [contextMenuOptions] - _Updatable._
190
- * Configure the context menu when right-clicking on a window. Supported menu items:
191
- * 'separator'
192
- * 'cut'
193
- * 'copy'
194
- * 'paste'
195
- * 'spellCheck'
196
- * 'inspect'
197
- * 'reload'
198
- * 'navigateForward'
199
- * 'navigateBack'
200
- * 'print'
201
- * @property {boolean} [contextMenuOptions.enabled = true] Should the context menu display on right click.
202
- * @property {string[]} [contextMenuSettings.template=[]] List of context menu items to display on right-click.
203
- *
204
- * @property {object} [cornerRounding] - _Updatable._
205
- * Defines and applies rounded corners for a frameless window. **NOTE:** On macOS corner is not ellipse but circle rounded by the
206
- * average of _height_ and _width_.
207
- * @property {number} [cornerRounding.height=0] The height in pixels.
208
- * @property {number} [cornerRounding.width=0] The width in pixels.
209
- *
210
- * @property {any} [customContext=""] - _Updatable. Inheritable._
211
- * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot}
212
- * is called. If a window in a Platform is trying to update or retrieve its own context, it can use the
213
- * {@link Platform#setWindowContext Platform.setWindowContext} and {@link Platform#getWindowContext Platform.getWindowContext} calls.
214
- * _When omitted, _inherits_ from the parent application._
215
- * As opposed to customData, this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
216
- *
217
- * @property {any} [customData=""] - _Updatable. Inheritable._
218
- * A field that the user can attach serializable data to be ferried around with the window options.
219
- * _When omitted, _inherits_ from the parent application._
220
- *
221
- * @property {object[]} [customRequestHeaders]
222
- * Defines list of custom headers for requests sent by the window.
223
- * @property {string[]} [customRequestHeaders.urlPatterns=[]] The URL patterns for which the headers will be applied
224
- * @property {object[]} [customRequestHeaders.headers=[]] Objects representing headers and their values,
225
- * where the object key is the name of header and value at key is the value of the header
226
- *
227
- * @property {boolean} [closeOnLastViewRemoved=true] - _Experimental._ _Updatable._
228
- * Toggling off would keep the Window alive even if all its Views were closed.
229
- * This is meant for advanced users and should be used with caution.
230
- * Limitations - Once a Layout has been emptied out of all views it's not usable anymore, and certain API calls will fail.
231
- * Use `layout.replace` to create a fresh Layout instance in case you want to populate it with Views again.
232
- * ** note ** - This option is ignored in non-Platforms apps.
233
- *
234
- * @property {boolean} [defaultCentered=false]
235
- * Centers the window in the primary monitor. This option overrides `defaultLeft` and `defaultTop`. When `saveWindowState` is `true`,
236
- * this value will be ignored for subsequent launches in favor of the cached value. **NOTE:** On macOS _defaultCenter_ is
237
- * somewhat above center vertically.
238
- *
239
- * @property {number} [defaultHeight=500]
240
- * The default height of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent launches
241
- * in favor of the cached value.
242
- *
243
- * @property {number} [defaultLeft=100]
244
- * The default left position of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent
245
- * launches in favor of the cached value.
246
- *
247
- * @property {number} [defaultTop=100]
248
- * The default top position of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent
249
- * launches in favor of the cached value.
250
- *
251
- * @property {number} [defaultWidth=800]
252
- * The default width of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent
253
- * launches in favor of the cached value.
254
- *
255
- * @property {boolean} [includeInSnapshots=true] - _Updatable._
256
- * When true, the window will be be included in snapshots returned by Platform.getSnapshot(). Turning this off may be desirable when dealing with
257
- * inherently temporary windows whose state shouldn't be preserved, such as modals, menus, or popups.
258
- *
259
- * @property {boolean} [frame=true] - _Updatable._
260
- * A flag to show the frame.
261
- *
262
- * @hidden-property {boolean} [hideOnClose=false] - A flag to allow a window to be hidden when the close button is clicked.
263
- *
264
- * @property {object[]} [hotkeys=[]] - _Updatable._
265
- * Defines the list of hotkeys that will be emitted as a `hotkey` event on the window. For usage example see [example]{@tutorial hotkeys}.
266
- * Within Platform, OpenFin also implements a set of pre-defined actions called
267
- * [keyboard commands]{@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands}
268
- * that can be assigned to a specific hotkey in the platform manifest.
269
- * @property {string} hotkeys.keys The key combination of the hotkey, i.e. "Ctrl+T"
270
- * @property {boolean} [hotkeys.preventDefault=false] Whether or not to prevent default key handling before emitting the event
271
- *
272
- * @property {string} [icon] - _Updatable. Inheritable._
273
- * A URL for the icon to be shown in the window title bar and the taskbar.
274
- * When omitted, inherits from the parent application._
275
- * note: Window OS caches taskbar icons, therefore an icon change might only be visible after the cache is removed or the uuid is changed.
276
- *
277
- * @property {number} [maxHeight=-1] - _Updatable._
278
- * The maximum height of a window. Will default to the OS defined value if set to -1.
279
- *
280
- * @property {boolean} [maximizable=true] - _Updatable._
281
- * A flag that lets the window be maximized.
282
- *
283
- * @property {number} [maxWidth=-1] - _Updatable._
284
- * The maximum width of a window. Will default to the OS defined value if set to -1.
285
- *
286
- * @property {number} [minHeight=0] - _Updatable._
287
- * The minimum height of a window.
288
- *
289
- * @property {boolean} [minimizable=true] - _Updatable._
290
- * A flag that lets the window be minimized.
291
- *
292
- * @property {number} [minWidth=0] - _Updatable._
293
- * The minimum width of a window.
294
- *
295
- * @property {Identity} [modalParentIdentity]
296
- * Parent identity of a modal window. It will create a modal child window when this option is set.
297
- *
298
- * @property {string} name
299
- * The name of the window.
300
- *
301
- * @property {number} [opacity=1.0] - _Updatable._
302
- * A flag that specifies how transparent the window will be.
303
- * Changing opacity doesn't work on Windows 7 without Aero so setting this value will have no effect there.
304
- * This value is clamped between `0.0` and `1.0`.
305
- *
306
- * @property {preloadScript[]} [preloadScripts] - _Inheritable_
307
- * A list of scripts that are eval'ed before other scripts in the page. When omitted, _inherits_
308
- * from the parent application.
309
- *
310
- * @property {string} [processAffinity]
311
- * A string to attempt to group renderers together. Will only be used if pages are on the same origin.
312
- *
313
- * @property {boolean} [resizable=true] - _Updatable._
314
- * A flag to allow the user to resize the window.
315
- *
316
- * @property {object} [resizeRegion] - _Updatable._
317
- * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window.
318
- * @property {number} [resizeRegion.bottomRightCorner=9]
319
- * The size in pixels of an additional square resizable region located at the bottom right corner of a frameless window.
320
- * @property {number} [resizeRegion.size=7]
321
- * The size in pixels.
322
- * @property {object} [resizeRegion.sides={top:true,right:true,bottom:true,left:true}]
323
- * Sides that a window can be resized from.
324
- *
325
- * @property {boolean} [saveWindowState=true]
326
- * A flag to cache the location of the window.
327
- * ** note ** - This option is ignored in Platforms as it would cause inconsistent {@link Platform#applySnapshot applySnapshot} behavior.
328
- *
329
- * @property {boolean} [ignoreSavedWindowState]
330
- * A flag to ignore previously cached state of the window. It defaults the opposite value of `saveWindowState` to maintain backwards compatibility.
331
- *
332
- * @property {boolean} [shadow=false]
333
- * A flag to display a shadow on frameless windows.
334
- * `shadow` and `cornerRounding` are mutually exclusive.
335
- * On Windows 7, Aero theme is required.
336
- *
337
- * @property {boolean} [showBackgroundImages=false] - _Updatable._
338
- * Platforms Only. If true, will show background images in the layout when the Views are hidden.
339
- * This occurs when the window is resizing or a tab is being dragged within the layout.
340
- *
341
- * @property {boolean} [showTaskbarIcon=true] - _Updatable._ _Windows_.
342
- * A flag to show the window's icon in the taskbar.
343
- *
344
- * @property {boolean} [smallWindow=false]
345
- * A flag to specify a frameless window that can be be created and resized to less than 41x36 px (width x height).
346
- * _Note: Caveats of small windows are no Aero Snap and drag to/from maximize._
347
- * _Windows 10: Requires `maximizable` to be false. Resizing with the mouse is only possible down to 38x39 px._
348
- *
349
- * @property {boolean} [spellCheck=false]
350
- * Enable spell check in input text fields for the window.
351
- *
352
- * @property {string} [state="normal"]
353
- * The visible state of the window on creation.
354
- * One of:
355
- * * `"maximized"`
356
- * * `"minimized"`
357
- * * `"normal"`
358
- *
359
- * @property {string} [taskbarIcon=string] - Deprecated - use `icon` instead._Windows_.
360
- *
361
- * @property {string} [taskbarIconGroup=<application uuid>] - _Windows_.
362
- * Specify a taskbar group for the window.
363
- * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
364
- *
365
- * @property {string} [url="about:blank"]
366
- * The URL of the window.
367
- *
368
- * @property {string} [uuid=<application uuid>]
369
- * The `uuid` of the application, unique within the set of all `Application`s running in OpenFin Runtime.
370
- * If omitted, defaults to the `uuid` of the application spawning the window.
371
- * If given, must match the `uuid` of the application spawning the window.
372
- * In other words, the application's `uuid` is the only acceptable value, but is the default, so there's
373
- * really no need to provide it.
374
- *
375
- * @property {boolean} [waitForPageLoad=false]
376
- * When set to `true`, the window will not appear until the `window` object's `load` event fires.
377
- * When set to `false`, the window will appear immediately without waiting for content to be loaded.
378
- *
379
- * @property {ViewVisibility} [viewVisibility]
380
- * _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
381
- */
382
- /**
383
- * @PORTED
384
- * @typedef {Object} ViewVisibility _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
385
- * @property {ShowViewsOnWindowResize} [showViewsOnWindowResize] Enables views to be shown when a Platform Window is being resized by the user.
386
- * @property {ShowViewsOnSplitterDrag} [showViewsOnSplitterDrag] Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
387
- * @property {ShowViewsOnTabDrag} [showViewsOnTabDrag] _Supported on Windows Operating Systems only_. Allows views to be shown when the user is dragging a tab around a layout.
388
- */
389
- /**
390
- * @PORTED
391
- * @typedef {Object} ShowViewsOnWindowResize _Platform Windows Only_. Enables views to be shown when a Platform Window is being resized by the user.
392
- * @property {boolean} [enabled=false] Enables or disables showing Views when a Platform Window is being resized.
393
- * @property {number} [paintIntervalMs=0] Number of miliseconds to wait between view repaints.
394
- */
395
- /**
396
- * @REMOVED
397
- * @typedef {Object} ShowViewsOnSplitterDrag _Platform Windows Only_. Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
398
- * @property {boolean} [enabled=false] Enables or disables showing views when the layout splitter is being dragged.
399
- */
400
- /**
401
- * @REMOVED
402
- * @typedef {Object} ShowViewsOnTabDrag _Platform Windows Only_. Allows views to be shown when the user is manipulating the layout by repositioning a tab.
403
- * @property {boolean} [enabled=false] Enables or disables showing views when a tab is being dragged.
404
- */
405
- /**
406
- * @PORTED
407
- * @typedef {object} CapturePageOptions
408
- * @property { Area } [area] The area of the window to be captured.
409
- * @property { string } [format='png'] The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
410
- * @property { number } [quality=100] Number representing quality of JPEG image only. Between 0 - 100.
411
- */
412
- /**
413
- * @PORTED
414
- * @typedef { object } Area
415
- * @property { number } height Area's height
416
- * @property { number } width Area's width
417
- * @property { number } x X coordinate of area's starting point
418
- * @property { number } y Y coordinate of area's starting point
419
- */
420
- /**
421
- * @PORTED
422
- * @typedef {object} FindInPageOptions
423
- * @property {boolean} [forward=true] Whether to search forward or backward.
424
- * @property {boolean} [findNext=false] Whether to begin a new text finding session. Should be true for first requests, and false for subsequent requests. Defaults to false.
425
- * @property {boolean} [matchCase=false] Whether search should be case-sensitive.
426
- * @property {boolean} [wordStart=false] Whether to look only at the start of words.
427
- * @property {boolean} [medialCapitalAsWordStart=false]
428
- * When combined with wordStart, accepts a match in the middle of a word if the match begins with an uppercase letter followed by a<br>
429
- * lowercase or non-letter. Accepts several other intra-word matches.
430
- */
431
- /**
432
- * @REMOVED
433
- * @typedef {object} Transition
434
- * @property {Opacity} opacity - The Opacity transition
435
- * @property {Position} position - The Position transition
436
- * @property {Size} size - The Size transition
437
- */
438
- /**
439
- * @PORTED
440
- * @typedef {object} TransitionOptions
441
- * @property {boolean} interrupt - This option interrupts the current animation. When false it pushes
442
- this animation onto the end of the animation queue.
443
- * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
444
- */
445
- /**
446
- * @PORTED
447
- * @typedef {object} Size
448
- * @property {number} duration - The total time in milliseconds this transition should take.
449
- * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
450
- * @property {number} width - Optional if height is present. Defaults to the window's current width.
451
- * @property {number} height - Optional if width is present. Defaults to the window's current height.
452
- */
453
- /**
454
- * @PORTED
455
- * @typedef {object} Position
456
- * @property {number} duration - The total time in milliseconds this transition should take.
457
- * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
458
- * @property {number} left - Defaults to the window's current left position in virtual screen coordinates.
459
- * @property {number} top - Defaults to the window's current top position in virtual screen coordinates.
460
- */
461
- /**
462
- * @PORTED
463
- * @typedef {object} Opacity
464
- * @property {number} duration - The total time in milliseconds this transition should take.
465
- * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
466
- * @property {number} opacity - This value is clamped from 0.0 to 1.0.
467
- */
468
- /**
469
- * @REMOVED
470
- * Bounds is a interface that has the properties of height,
471
- * width, left, top which are all numbers
472
- * @typedef { object } Bounds
473
- * @property { number } height Get the application height bound
474
- * @property { number } width Get the application width bound
475
- * @property { number } top Get the application top bound
476
- * @property { number } left Get the application left bound
477
- * @property { number } right Get the application right bound
478
- * @property { number } bottom Get the application bottom bound
479
- */
480
- /**
481
- * @classdesc A basic window that wraps a native HTML window. Provides more fine-grained
482
- * control over the window state such as the ability to minimize, maximize, restore, etc.
483
- * By default a window does not show upon instantiation; instead the window's show() method
484
- * must be invoked manually. The new window appears in the same process as the parent window.
485
- * It has the ability to listen for <a href="tutorial-Window.EventEmitter.html">window specific events</a>.
486
- * @class
487
- * @alias Window
488
- * @hideconstructor
489
- */
490
- // The window.Window name is taken
491
- class _Window extends main_1.WebContents {
492
- constructor(wire, identity) {
493
- super(wire, identity, 'window');
494
- this.identity = identity;
495
- }
496
- /**
497
- * Adds a listener to the end of the listeners array for the specified event.
498
- * @param { string | symbol } eventType - The type of the event.
499
- * @param { Function } listener - Called whenever an event of the specified type occurs.
500
- * @param { SubOptions } [options] - Option to support event timestamps.
501
- * @return {Promise.<this>}
502
- * @function addListener
503
- * @memberof Window
504
- * @instance
505
- * @tutorial Window.EventEmitter
506
- */
507
- /**
508
- * Adds a listener to the end of the listeners array for the specified event.
509
- * @param { string | symbol } eventType - The type of the event.
510
- * @param { Function } listener - Called whenever an event of the specified type occurs.
511
- * @param { SubOptions } [options] - Option to support event timestamps.
512
- * @return {Promise.<this>}
513
- * @function on
514
- * @memberof Window
515
- * @instance
516
- * @tutorial Window.EventEmitter
517
- */
518
- /**
519
- * 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.
520
- * @param { string | symbol } eventType - The type of the event.
521
- * @param { Function } listener - The callback function.
522
- * @param { SubOptions } [options] - Option to support event timestamps.
523
- * @return {Promise.<this>}
524
- * @function once
525
- * @memberof Window
526
- * @instance
527
- * @tutorial Window.EventEmitter
528
- */
529
- /**
530
- * Adds a listener to the beginning of the listeners array for the specified event.
531
- * @param { string | symbol } eventType - The type of the event.
532
- * @param { Function } listener - The callback function.
533
- * @param { SubOptions } [options] - Option to support event timestamps.
534
- * @return {Promise.<this>}
535
- * @function prependListener
536
- * @memberof Window
537
- * @instance
538
- * @tutorial Window.EventEmitter
539
- */
540
- /**
541
- * 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.
542
- * The listener is added to the beginning of the listeners array.
543
- * @param { string | symbol } eventType - The type of the event.
544
- * @param { Function } listener - The callback function.
545
- * @param { SubOptions } [options] - Option to support event timestamps.
546
- * @return {Promise.<this>}
547
- * @function prependOnceListener
548
- * @memberof Window
549
- * @instance
550
- * @tutorial Window.EventEmitter
551
- */
552
- /**
553
- * Remove a listener from the listener array for the specified event.
554
- * Caution: Calling this method changes the array indices in the listener array behind the listener.
555
- * @param { string | symbol } eventType - The type of the event.
556
- * @param { Function } listener - The callback function.
557
- * @param { SubOptions } [options] - Option to support event timestamps.
558
- * @return {Promise.<this>}
559
- * @function removeListener
560
- * @memberof Window
561
- * @instance
562
- * @tutorial Window.EventEmitter
563
- */
564
- /**
565
- * Removes all listeners, or those of the specified event.
566
- * @param { string | symbol } [eventType] - The type of the event.
567
- * @return {Promise.<this>}
568
- * @function removeAllListeners
569
- * @memberof Window
570
- * @instance
571
- * @tutorial Window.EventEmitter
572
- */
573
- /**
574
- * Gets a base64 encoded image of the window or a part of it.
575
- * @function capturePage
576
- * @param { CapturePageOptions } [options] options for capturePage call.
577
- * @return {Promise.<string>}
578
- * @memberof Window
579
- * @instance
580
- * @tutorial Window.capturePage
581
- */
582
- /**
583
- * Executes Javascript on the window, restricted to windows you own or windows owned by
584
- * applications you have created.
585
- * @param { string } code JavaScript code to be executed on the window.
586
- * @function executeJavaScript
587
- * @memberOf Window
588
- * @instance
589
- * @return {Promise.<void>}
590
- * @tutorial Window.executeJavaScript
591
- */
592
- /**
593
- * Gives focus to the window.
594
- * @return {Promise.<void>}
595
- * @function focus
596
- * @emits focused
597
- * @memberOf Window
598
- * @instance
599
- * @tutorial Window.focus
600
- */
601
- /**
602
- * Returns the zoom level of the window.
603
- * @function getZoomLevel
604
- * @memberOf Window
605
- * @instance
606
- * @return {Promise.<number>}
607
- * @tutorial Window.getZoomLevel
608
- */
609
- /**
610
- * Sets the zoom level of the window.
611
- * @param { number } level The zoom level
612
- * @function setZoomLevel
613
- * @memberOf Window
614
- * @instance
615
- * @return {Promise.<void>}
616
- * @tutorial Window.setZoomLevel
617
- */
618
- /**
619
- * Find and highlight text on a page.
620
- * @param { string } searchTerm Term to find in page
621
- * @param { FindInPageOptions } options Search options
622
- * @function findInPage
623
- * @memberOf Window
624
- * @instance
625
- * @return {Promise.<number>}
626
- * @tutorial Window.findInPage
627
- */
628
- /**
629
- * Stops any findInPage call with the provided action.
630
- * @param {string} action
631
- * Action to execute when stopping a find in page:<br>
632
- * "clearSelection" - Clear the selection.<br>
633
- * "keepSelection" - Translate the selection into a normal selection.<br>
634
- * "activateSelection" - Focus and click the selection node.<br>
635
- * @function stopFindInPage
636
- * @memberOf Window
637
- * @instance
638
- * @return {Promise.<void>}
639
- * @tutorial Window.stopFindInPage
640
- */
641
- /**
642
- * Navigates the window to a specified URL. The url must contain the protocol prefix such as http:// or https://.
643
- * @param {string} url - The URL to navigate the window to.
644
- * @function navigate
645
- * @memberOf Window
646
- * @instance
647
- * @return {Promise.<void>}
648
- * @tutorial Window.navigate
649
- */
650
- /**
651
- * Navigates the window back one page.
652
- * @function navigateBack
653
- * @memberOf Window
654
- * @instance
655
- * @return {Promise.<void>}
656
- * @tutorial Window.navigateBack
657
- */
658
- /**
659
- * Navigates the window forward one page.
660
- * @function navigateForward
661
- * @memberOf Window
662
- * @instance
663
- * @return {Promise.<void>}
664
- * @tutorial Window.navigateForward
665
- */
666
- /**
667
- * Stops any current navigation the window is performing.
668
- * @function stopNavigation
669
- * @memberOf Window
670
- * @instance
671
- * @return {Promise.<void>}
672
- * @tutorial Window.stopNavigation
673
- */
674
- /**
675
- * Reloads the window current page
676
- * @function reload
677
- * @memberOf Window
678
- * @instance
679
- * @return {Promise.<void>}
680
- * @tutorial Window.reload
681
- */
682
- /**
683
- * Prints the window's web page
684
- * @param { PrintOptions } [options] Printer Options
685
- * @function print
686
- * @memberOf Window
687
- * @instance
688
- * @return {Promise.<void>}
689
- * @tutorial Window.print
690
- */
691
- /**
692
- * Returns an array with all system printers
693
- * @deprecated use System.getPrinters instead
694
- * @function getPrinters
695
- * @memberOf Window
696
- * @instance
697
- * @return { Promise.Array.<PrinterInfo> }
698
- * @tutorial Window.getPrinters
699
- */
700
- /**
701
- * Retrieves the process information associated with a window.
702
- * @function getProcessInfo
703
- * @memberOf Window
704
- * @instance
705
- * @return {Promise.<EntityProcessDetails>}
706
- * @tutorial Window.getProcessInfo
707
- */
708
- /**
709
- * Retrieves information on all Shared Workers.
710
- * @function getSharedWorkers
711
- * @memberOf Window
712
- * @instance
713
- * @return {Promise.Array.<SharedWorkerInfo>}
714
- * @tutorial Window.getSharedWorkers
715
- */
716
- /**
717
- * Opens the developer tools for the shared worker context.
718
- * @function inspectSharedWorker
719
- * @memberOf Window
720
- * @instance
721
- * @return {Promise.<void>}
722
- * @tutorial Window.inspectSharedWorker
723
- */
724
- /**
725
- * Inspects the shared worker based on its ID.
726
- * @param { string } workerId - The id of the shared worker.
727
- * @function inspectSharedWorkerById
728
- * @memberOf Window
729
- * @instance
730
- * @return {Promise.<void>}
731
- * @tutorial Window.inspectSharedWorkerById
732
- */
733
- /**
734
- * Opens the developer tools for the service worker context.
735
- * @function inspectServiceWorker
736
- * @memberOf Window
737
- * @instance
738
- * @return {Promise.<void>}
739
- * @tutorial Window.inspectServiceWorker
740
- */
741
- // create a new window
742
- createWindow(options) {
743
- this.wire.sendAction('window-create-window', this.identity).catch((e) => {
744
- // we do not want to expose this error, just continue if this analytics-only call fails
745
- });
746
- return new Promise((resolve, reject) => {
747
- const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
748
- // need to call pageResponse, otherwise when a child window is created, page is not loaded
749
- const pageResponse = new Promise((resolve) => {
750
- // TODO: fix typing (internal)
751
- // @ts-expect-error
752
- this.on(CONSTRUCTOR_CB_TOPIC, function fireConstructor(response) {
753
- let cbPayload;
754
- const { success } = response;
755
- const responseData = response.data;
756
- const { message } = responseData;
757
- if (success) {
758
- cbPayload = {
759
- httpResponseCode: responseData.httpResponseCode,
760
- apiInjected: responseData.apiInjected
761
- };
762
- }
763
- else {
764
- cbPayload = {
765
- message: responseData.message,
766
- networkErrorCode: responseData.networkErrorCode,
767
- stack: responseData.stack
768
- };
769
- }
770
- this.removeListener(CONSTRUCTOR_CB_TOPIC, fireConstructor);
771
- resolve({
772
- message,
773
- cbPayload,
774
- success
775
- });
776
- });
777
- });
778
- // set defaults:
779
- if (options.waitForPageLoad === undefined) {
780
- options.waitForPageLoad = false;
781
- }
782
- if (options.autoShow === undefined) {
783
- options.autoShow = true;
784
- }
785
- const windowCreation = this.wire.environment.createChildContent({ entityType: 'window', options });
786
- Promise.all([pageResponse, windowCreation])
787
- .then((resolvedArr) => {
788
- const pageResolve = resolvedArr[0];
789
- if (pageResolve.success) {
790
- resolve(this);
791
- }
792
- else {
793
- reject(pageResolve);
794
- }
795
- try {
796
- // this is to enforce a 5.0 contract that the child's main function
797
- // will not fire before the parent's success callback on creation.
798
- // if the child window is not accessible (CORS) this contract does
799
- // not hold.
800
- const webWindow = this.getWebWindow();
801
- webWindow.fin.__internal_.openerSuccessCBCalled();
802
- }
803
- catch (e) {
804
- // common for main windows, we do not want to expose this error. here just to have a debug target.
805
- // console.error(e);
806
- }
807
- })
808
- .catch(reject);
809
- });
810
- }
811
- /**
812
- * Retrieves an array of frame info objects representing the main frame and any
813
- * iframes that are currently on the page.
814
- * @return {Promise.<Array<FrameInfo>>}
815
- * @tutorial Window.getAllFrames
816
- */
817
- getAllFrames() {
818
- return this.wire.sendAction('get-all-frames', this.identity).then(({ payload }) => payload.data);
819
- }
820
- /**
821
- * Gets the current bounds (top, bottom, right, left, width, height) of the window.
822
- * @return {Promise.<Bounds>}
823
- * @tutorial Window.getBounds
824
- */
825
- getBounds() {
826
- return this.wire
827
- .sendAction('get-window-bounds', this.identity)
828
- .then(({ payload }) => payload.data);
829
- }
830
- /**
831
- * Centers the window on its current screen.
832
- * @return {Promise.<void>}
833
- * @tutorial Window.center
834
- */
835
- center() {
836
- return this.wire.sendAction('center-window', this.identity).then(() => undefined);
837
- }
838
- /**
839
- * Removes focus from the window.
840
- * @return {Promise.<void>}
841
- * @tutorial Window.blur
842
- */
843
- blur() {
844
- return this.wire.sendAction('blur-window', this.identity).then(() => undefined);
845
- }
846
- /**
847
- * Brings the window to the front of the window stack.
848
- * @return {Promise.<void>}
849
- * @tutorial Window.bringToFront
850
- */
851
- bringToFront() {
852
- return this.wire.sendAction('bring-window-to-front', this.identity).then(() => undefined);
853
- }
854
- /**
855
- * Performs the specified window transitions.
856
- * @param {Transition} transitions - Describes the animations to perform. See the tutorial.
857
- * @param {TransitionOptions} options - Options for the animation. See the tutorial.
858
- * @return {Promise.<void>}
859
- * @tutorial Window.animate
860
- */
861
- animate(transitions, options) {
862
- return this.wire
863
- .sendAction('animate-window', {
864
- transitions,
865
- options,
866
- ...this.identity
867
- })
868
- .then(() => undefined);
869
- }
870
- /**
871
- * Hides the window.
872
- * @return {Promise.<void>}
873
- * @tutorial Window.hide
874
- */
875
- hide() {
876
- return this.wire.sendAction('hide-window', this.identity).then(() => undefined);
877
- }
878
- /**
879
- * closes the window application
880
- * @param { boolean } [force = false] Close will be prevented from closing when force is false and
881
- * ‘close-requested’ has been subscribed to for application’s main window.
882
- * @return {Promise.<void>}
883
- * @tutorial Window.close
884
- */
885
- close(force = false) {
886
- return this.wire.sendAction('close-window', { force, ...this.identity }).then(() => {
887
- Object.setPrototypeOf(this, null);
888
- return undefined;
889
- });
890
- }
891
- focusedWebViewWasChanged() {
892
- return this.wire.sendAction('focused-webview-changed', this.identity).then(() => undefined);
893
- }
894
- /**
895
- * Returns the native OS level Id.
896
- * In Windows, it will return the Windows [handle](https://docs.microsoft.com/en-us/windows/desktop/WinProg/windows-data-types#HWND).
897
- * @return {Promise.<string>}
898
- * @tutorial Window.getNativeId
899
- */
900
- getNativeId() {
901
- return this.wire.sendAction('get-window-native-id', this.identity).then(({ payload }) => payload.data);
902
- }
903
- /**
904
- * Retrieves window's attached views.
905
- * @experimental
906
- * @return {Promise.Array.<View>}
907
- * @tutorial Window.getCurrentViews
908
- */
909
- async getCurrentViews() {
910
- const { payload } = await this.wire.sendAction('window-get-views', this.identity);
911
- return payload.data.map((id) => new view_1.View(this.wire, id));
912
- }
913
- /*
914
- * @deprecated Use {@link Window.disableUserMovement} instead.
915
- */
916
- disableFrame() {
917
- console.warn('Function is deprecated; use disableUserMovement instead.');
918
- return this.wire.sendAction('disable-window-frame', this.identity).then(() => undefined);
919
- }
920
- /**
921
- * Prevents a user from changing a window's size/position when using the window's frame.
922
- * @return {Promise.<void>}
923
- * @tutorial Window.disableUserMovement
924
- */
925
- disableUserMovement() {
926
- return this.wire.sendAction('disable-window-frame', this.identity).then(() => undefined);
927
- }
928
- /*
929
- * @deprecated Use {@link Window.enableUserMovement} instead.
930
- */
931
- enableFrame() {
932
- console.warn('Function is deprecated; use enableUserMovement instead.');
933
- return this.wire.sendAction('enable-window-frame', this.identity).then(() => undefined);
934
- }
935
- /**
936
- * Re-enables user changes to a window's size/position when using the window's frame.
937
- * @return {Promise.<void>}
938
- * @tutorial Window.enableUserMovement
939
- */
940
- enableUserMovement() {
941
- return this.wire.sendAction('enable-window-frame', this.identity).then(() => undefined);
942
- }
943
- /**
944
- * Flashes the window’s frame and taskbar icon until stopFlashing is called or until a focus event is fired.
945
- * @return {Promise.<void>}
946
- * @tutorial Window.flash
947
- */
948
- flash() {
949
- return this.wire.sendAction('flash-window', this.identity).then(() => undefined);
950
- }
951
- /**
952
- * Stops the taskbar icon from flashing.
953
- * @return {Promise.<void>}
954
- * @tutorial Window.stopFlashing
955
- */
956
- stopFlashing() {
957
- return this.wire.sendAction('stop-flash-window', this.identity).then(() => undefined);
958
- }
959
- /**
960
- * Gets an information object for the window.
961
- * @return {Promise.<WindowInfo>}
962
- * @tutorial Window.getInfo
963
- */
964
- getInfo() {
965
- return this.wire.sendAction('get-window-info', this.identity).then(({ payload }) => payload.data);
966
- }
967
- /**
968
- * Retrieves the window's Layout
969
- * @return {Promise.<Layout>}
970
- * @tutorial Window.getLayout
971
- * @experimental
972
- */
973
- async getLayout() {
974
- this.wire.sendAction('window-get-layout', this.identity).catch((e) => {
975
- // don't expose
976
- });
977
- const opts = await this.getOptions();
978
- if (!opts.layout) {
979
- throw new Error('Window does not have a Layout');
980
- }
981
- return this.fin.Platform.Layout.wrap(this.identity);
982
- }
983
- /**
984
- * Gets the current settings of the window.
985
- * @return {Promise.<any>}
986
- * @tutorial Window.getOptions
987
- */
988
- getOptions() {
989
- return this.wire.sendAction('get-window-options', this.identity).then(({ payload }) => payload.data);
990
- }
991
- /**
992
- * Gets the parent application.
993
- * @return {Promise.<Application>}
994
- * @tutorial Window.getParentApplication
995
- */
996
- getParentApplication() {
997
- this.wire.sendAction('window-get-parent-application', this.identity).catch((e) => {
998
- // we do not want to expose this error, just continue if this analytics-only call fails
999
- });
1000
- return Promise.resolve(new application_1.Application(this.wire, this.identity));
1001
- }
1002
- /**
1003
- * Gets the parent window.
1004
- * @return {Promise.<_Window>}
1005
- * @tutorial Window.getParentWindow
1006
- */
1007
- getParentWindow() {
1008
- this.wire.sendAction('window-get-parent-window', this.identity).catch((e) => {
1009
- // we do not want to expose this error, just continue if this analytics-only call fails
1010
- });
1011
- return Promise.resolve(new application_1.Application(this.wire, this.identity)).then((app) => app.getWindow());
1012
- }
1013
- /**
1014
- * ***DEPRECATED - please use Window.capturePage.***
1015
- * Gets a base64 encoded PNG image of the window or just part a of it.
1016
- * @param { Area } [area] The area of the window to be captured.
1017
- * Omitting it will capture the whole visible window.
1018
- * @return {Promise.<string>}
1019
- * @tutorial Window.capturePage
1020
- */
1021
- async getSnapshot(area) {
1022
- const req = { area, ...this.identity };
1023
- console.warn('Window.getSnapshot has been deprecated, please use Window.capturePage');
1024
- const res = await this.wire.sendAction('get-window-snapshot', req);
1025
- return res.payload.data;
1026
- }
1027
- /**
1028
- * Gets the current state ("minimized", "maximized", or "normal") of the window.
1029
- * @return {Promise.<string>}
1030
- * @tutorial Window.getState
1031
- */
1032
- getState() {
1033
- return this.wire.sendAction('get-window-state', this.identity).then(({ payload }) => payload.data);
1034
- }
1035
- /**
1036
- * Previously called getNativeWindow.
1037
- * Returns the [Window Object](https://developer.mozilla.org/en-US/docs/Web/API/Window)
1038
- * that represents the web context of the target window. This is the same object that
1039
- * you would get from calling [window.open()](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) in a standard web context.
1040
- * The target window needs to be in the same application as the requesting window
1041
- * as well as comply with [same-origin](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) policy requirements.
1042
- * @return {object}
1043
- * @tutorial Window.getWebWindow
1044
- */
1045
- getWebWindow() {
1046
- this.wire.sendAction('window-get-web-window', this.identity).catch((e) => {
1047
- // we do not want to expose this error, just continue if this analytics-only call fails
1048
- });
1049
- return this.wire.environment.getWebWindow(this.identity);
1050
- }
1051
- /**
1052
- * Determines if the window is a main window.
1053
- * @return {boolean}
1054
- * @tutorial Window.isMainWindow
1055
- */
1056
- isMainWindow() {
1057
- this.wire.sendAction('window-is-main-window', this.identity).catch((e) => {
1058
- // we do not want to expose this error, just continue if this analytics-only call fails
1059
- });
1060
- return this.me.uuid === this.me.name;
1061
- }
1062
- /**
1063
- * Determines if the window is currently showing.
1064
- * @return {Promise.<boolean>}
1065
- * @tutorial Window.isShowing
1066
- */
1067
- isShowing() {
1068
- return this.wire.sendAction('is-window-showing', this.identity).then(({ payload }) => payload.data);
1069
- }
1070
- /**
1071
- * Maximizes the window
1072
- * @return {Promise.<void>}
1073
- * @tutorial Window.maximize
1074
- */
1075
- maximize() {
1076
- return this.wire.sendAction('maximize-window', this.identity).then(() => undefined);
1077
- }
1078
- /**
1079
- * Minimizes the window.
1080
- * @return {Promise.<void>}
1081
- * @tutorial Window.minimize
1082
- */
1083
- minimize() {
1084
- return this.wire.sendAction('minimize-window', this.identity).then(() => undefined);
1085
- }
1086
- /**
1087
- * Moves the window by a specified amount.
1088
- * @param { number } deltaLeft The change in the left position of the window
1089
- * @param { number } deltaTop The change in the top position of the window
1090
- * @return {Promise.<void>}
1091
- * @tutorial Window.moveBy
1092
- */
1093
- moveBy(deltaLeft, deltaTop) {
1094
- return this.wire
1095
- .sendAction('move-window-by', {
1096
- deltaLeft,
1097
- deltaTop,
1098
- ...this.identity
1099
- })
1100
- .then(() => undefined);
1101
- }
1102
- /**
1103
- * Moves the window to a specified location.
1104
- * @param { number } left The left position of the window
1105
- * @param { number } top The top position of the window
1106
- * @return {Promise.<void>}
1107
- * @tutorial Window.moveTo
1108
- */
1109
- moveTo(left, top) {
1110
- return this.wire
1111
- .sendAction('move-window', {
1112
- left,
1113
- top,
1114
- ...this.identity
1115
- })
1116
- .then(() => undefined);
1117
- }
1118
- /**
1119
- * Resizes the window by a specified amount.
1120
- * @param { number } deltaWidth The change in the width of the window
1121
- * @param { number } deltaHeight The change in the height of the window
1122
- * @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
1123
- * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
1124
- * If undefined, the default is "top-left"
1125
- * @return {Promise.<void>}
1126
- * @tutorial Window.resizeBy
1127
- */
1128
- resizeBy(deltaWidth, deltaHeight, anchor) {
1129
- return this.wire
1130
- .sendAction('resize-window-by', {
1131
- deltaWidth: Math.floor(deltaWidth),
1132
- deltaHeight: Math.floor(deltaHeight),
1133
- anchor,
1134
- ...this.identity
1135
- })
1136
- .then(() => undefined);
1137
- }
1138
- /**
1139
- * Resizes the window to the specified dimensions.
1140
- * @param { number } width The change in the width of the window
1141
- * @param { number } height The change in the height of the window
1142
- * @param { AnchorType } anchor Specifies a corner to remain fixed during the resize.
1143
- * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right".
1144
- * If undefined, the default is "top-left"
1145
- * @return {Promise.<void>}
1146
- * @tutorial Window.resizeTo
1147
- */
1148
- resizeTo(width, height, anchor) {
1149
- return this.wire
1150
- .sendAction('resize-window', {
1151
- width: Math.floor(width),
1152
- height: Math.floor(height),
1153
- anchor,
1154
- ...this.identity
1155
- })
1156
- .then(() => undefined);
1157
- }
1158
- /**
1159
- * Restores the window to its normal state (i.e., unminimized, unmaximized).
1160
- * @return {Promise.<void>}
1161
- * @tutorial Window.restore
1162
- */
1163
- restore() {
1164
- return this.wire.sendAction('restore-window', this.identity).then(() => undefined);
1165
- }
1166
- /**
1167
- * Will bring the window to the front of the entire stack and give it focus.
1168
- * @return {Promise.<void>}
1169
- * @tutorial Window.setAsForeground
1170
- */
1171
- setAsForeground() {
1172
- return this.wire.sendAction('set-foreground-window', this.identity).then(() => undefined);
1173
- }
1174
- /**
1175
- * Sets the window's size and position.
1176
- * @property { Bounds } bounds This is a * @type {string} name - name of the window.object that holds the propertys of
1177
- * @return {Promise.<void>}
1178
- * @tutorial Window.setBounds
1179
- */
1180
- setBounds(bounds) {
1181
- return this.wire.sendAction('set-window-bounds', { ...bounds, ...this.identity }).then(() => undefined);
1182
- }
1183
- /**
1184
- * Shows the window if it is hidden.
1185
- * @param { boolean } [force = false] Show will be prevented from showing when force is false and
1186
- * ‘show-requested’ has been subscribed to for application’s main window.
1187
- * @return {Promise.<void>}
1188
- * @tutorial Window.show
1189
- */
1190
- show(force = false) {
1191
- return this.wire.sendAction('show-window', { force, ...this.identity }).then(() => undefined);
1192
- }
1193
- /**
1194
- * Shows the window if it is hidden at the specified location.
1195
- * If the toggle parameter is set to true, the window will
1196
- * alternate between showing and hiding.
1197
- * @param { number } left The left position of the window
1198
- * @param { number } top The right position of the window
1199
- * @param { boolean } force Show will be prevented from closing when force is false and
1200
- * ‘show-requested’ has been subscribed to for application’s main window
1201
- * @return {Promise.<void>}
1202
- * @tutorial Window.showAt
1203
- */
1204
- showAt(left, top, force = false) {
1205
- return this.wire
1206
- .sendAction('show-at-window', {
1207
- force,
1208
- left: Math.floor(left),
1209
- top: Math.floor(top),
1210
- ...this.identity
1211
- })
1212
- .then(() => undefined);
1213
- }
1214
- /**
1215
- * Shows the Chromium Developer Tools
1216
- * @return {Promise.<void>}
1217
- * @tutorial Window.showDeveloperTools
1218
- */
1219
- /**
1220
- * Updates the window using the passed options.
1221
- * Values that are objects are deep-merged, overwriting only the values that are provided.
1222
- * @param {*} options Changes a window's options that were defined upon creation. See tutorial
1223
- * @return {Promise.<void>}
1224
- * @tutorial Window.updateOptions
1225
- */
1226
- updateOptions(options) {
1227
- return this.wire.sendAction('update-window-options', { options, ...this.identity }).then(() => undefined);
1228
- }
1229
- /**
1230
- * Provides credentials to authentication requests
1231
- * @param { string } userName userName to provide to the authentication challenge
1232
- * @param { string } password password to provide to the authentication challenge
1233
- * @return {Promise.<void>}
1234
- * @tutorial Window.authenticate
1235
- */
1236
- authenticate(userName, password) {
1237
- return this.wire
1238
- .sendAction('window-authenticate', { userName, password, ...this.identity })
1239
- .then(() => undefined);
1240
- }
1241
- /**
1242
- * @typedef {object} ShowPopupMenuOptions
1243
- * @property {Array<MenuItemTemplate>} template - An array describing the menu to show.
1244
- * @property {number} [x] - The window x coordinate where to show the menu. Defaults to mouse position. If using must also use `y`.
1245
- * @property {number} [y] - The window y coordinate where to show the menu. Defaults to mouse position. If using must also use `x`
1246
- */
1247
- /**
1248
- * @typedef {object} MenuItemTemplate
1249
- * @property {*} data - Data to be returned if the user selects the element. Must be serializable. Large objects can have a performance impact.
1250
- * @property {'normal' | 'separator' | 'submenu' | 'checkbox'} [type] - Defaults to 'normal' unless a 'submenu' key exists
1251
- * @property {string} [label] - The text to show on the menu item. Should be left undefined for `type: 'separator'`
1252
- * @property {boolean} [enabled] - If false, the menu item will be greyed out and unclickable.
1253
- * @property {boolean} [visible] - If false, the menu item will be entirely hidden.
1254
- * @property {boolean} [checked] - Should only be specified for `checkbox` type menu items.
1255
- * @property {string} [icon] - Image Data URI with image dimensions inferred from the encoded string
1256
- * @property {Array<MenuItemTemplate>} [submenu] Should be specified for `submenu` type menu items. If `submenu` is specified, the `type: 'submenu'` can be omitted.
1257
- */
1258
- /**
1259
- * @typedef {object} MenuResult
1260
- * @property {'clicked' | 'closed'} result - Whether the user clicked on a menu item or the menu was closed (user clicked elsewhere).
1261
- * @property {* | undefined} [data] - The data property of the menu item clicked by the user. Only defined if result was `clicked`.
1262
- */
1263
- /**
1264
- * 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).
1265
- * 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.
1266
- * Calling this method will close previously opened menus.
1267
- * @experimental
1268
- * @param {ShowPopupMenuOptions} options
1269
- * @return {Promise<MenuResult>}
1270
- * @tutorial Window.showPopupMenu
1271
- */
1272
- async showPopupMenu(options) {
1273
- const { payload } = await this.wire.sendAction('show-popup-menu', { options, ...this.identity });
1274
- return payload.data;
1275
- }
1276
- /**
1277
- * Closes the window's popup menu, if one exists.
1278
- * @experimental
1279
- * @return {Promise<void>}
1280
- * @tutorial Window.closePopupMenu
1281
- */
1282
- async closePopupMenu() {
1283
- return this.wire.sendAction('close-popup-menu', { ...this.identity }).then(() => undefined);
1284
- }
1285
- /**
1286
- * @typedef {object} PopupOptions
1287
- * @property {string} [name] - If a window with this `name` exists, it will be shown as a popup. Otherwise, a new window with this `name` will be created. If this `name` is undefined, `initialOptions.name` will be used. If this `name` and `intialOptions.name` are both undefined, a `name` will be generated.
1288
- * @property {string} [url] - Navigates to this `url` if showing an existing window as a popup, otherwise the newly created window will load this `url`.
1289
- * @property {Window~options} [initialOptions] - Window creation options when using `showPopupWindow` to create a new window.
1290
- * @property {Window~options} [additionalOptions] - Updatable window options applied to new and existing windows when shown as popups.
1291
- * @property {function} [onPopupResult] - Executed when this window's popup calls `dispatchPopupResult`. Note: if this is defined, `showPopupWindow` will not return a `PopupResult`.
1292
- * @property {function} [onPopupReady] - Executed when the popup window is shown. Provides the popup window to the provided function, and allows for easy access the popup window for additional behavior customization.
1293
- * @property {number} [height] - Height of the popup window (takes priority over `intialOptions` size properties).
1294
- * @property {number} [width] - Width of the popup window (takes priority over `intialOptions` size properties).
1295
- * @property {number} [x] - Left position where the popup window will be shown (relative to the window calling `showPopupWindow`).
1296
- * @property {number} [y] - Top position where the popup window will be shown (relative to the window calling `showPopupWindow`).
1297
- * @property {'modal' | 'hide' | 'close'} [blurBehavior] - Determines what happens if the popup window is blurred. 'modal' restricts resizing and positioning in the caller, 'hide' hides the popup window on blur and 'close' closes the popup window on blur.
1298
- * @property {'none' | 'hide' | 'close'} [resultDispatchBehavior] - Determines what happens when the popup window calls `dispatchPopupResult`. 'none' will do nothing, 'hide' hides the popup window on `dispatchPopupResult` and 'close' closes the popup window on `dispatchPopupResult`.
1299
- * @property {boolean} [focus] - Determines if the popup window should or should not be focused when it is shown.
1300
- * @property {boolean} [hideOnClose] - Hide the popup window instead of closing whenever `close` is called on it. Note: if this is `true` and `blurBehavior` and/or `resultDispatchBehavior` are set to `close`, the window will be hidden.
1301
- */
1302
- /**
1303
- * @typedef {object} PopupResult
1304
- * @property {Identity} identity - `name` and `uuid` of the popup window that called dispatched this result.
1305
- * @property {'clicked' | 'dismissed'} result - Result of the user interaction with the popup window.
1306
- * @property {* | undefined} [data] - Data passed to `dispatchPopupResult`.
1307
- */
1308
- /**
1309
- * Shows a popup window. If this window currently has a popup open, closes it.
1310
- * @function showPopupWindow
1311
- * @memberOf Window
1312
- * @instance
1313
- * @param {PopupOptions} options
1314
- * @return {Promise<PopupResult>}
1315
- * @tutorial Window.showPopupWindow
1316
- */
1317
- /**
1318
- * Dispatch a result to the caller of `showPopupWindow`. If this window isn't currently being shown as a popup, this call will silently fail.
1319
- * @param {*} data Serializable data to send to the caller window.
1320
- * @return {Promise<void>}
1321
- * @tutorial Window.dispatchPopupResult
1322
- */
1323
- async dispatchPopupResult(data) {
1324
- this.wire.sendAction('window-dispatch-popup-result', this.identity).catch((e) => {
1325
- // we do not want to expose this error, just continue if this analytics-only call fails
1326
- });
1327
- await this.wire.sendAction('dispatch-popup-result', { data, ...this.identity });
1328
- }
1329
- /**
1330
- * Prints the contents of the window.
1331
- *
1332
- * @param options Configuration for the print task.
1333
- * @tutorial Window.print
1334
- */
1335
- async print(options = { content: 'self' }) {
1336
- switch (options.content) {
1337
- case undefined:
1338
- case 'self':
1339
- return super.print(options);
1340
- case 'screenshot':
1341
- return this.wire.sendAction('print-screenshot', this.identity).then(() => undefined);
1342
- case 'views':
1343
- return this.wire.sendAction('print-views', { ...this.identity, options }).then(() => undefined);
1344
- default:
1345
- return undefined;
1346
- }
1347
- }
1348
- }
1349
- exports._Window = _Window;