@openfin/core 25.68.30 → 25.70.2

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 (199) hide show
  1. package/OpenFin.d.ts +30 -826
  2. package/README.md +12 -2
  3. package/package.json +1 -1
  4. package/src/api/application/Factory.d.ts +145 -145
  5. package/src/api/application/Factory.js +229 -229
  6. package/src/api/application/Instance.d.ts +301 -302
  7. package/src/api/application/Instance.js +412 -412
  8. package/src/api/application/index.d.ts +3 -3
  9. package/src/api/application/index.js +15 -15
  10. package/src/api/base.d.ts +43 -43
  11. package/src/api/base.js +177 -177
  12. package/src/api/clipboard/index.d.ts +69 -69
  13. package/src/api/clipboard/index.js +88 -88
  14. package/src/api/events/application.d.ts +69 -0
  15. package/src/api/events/application.js +2 -0
  16. package/src/api/events/base.d.ts +17 -0
  17. package/src/api/events/base.js +2 -0
  18. package/src/api/events/channel.d.ts +10 -11
  19. package/src/api/events/channel.js +2 -2
  20. package/src/api/events/emitterMap.d.ts +11 -11
  21. package/src/api/events/emitterMap.js +35 -35
  22. package/src/api/events/eventAggregator.d.ts +5 -5
  23. package/src/api/events/eventAggregator.js +43 -43
  24. package/src/api/events/externalApplication.d.ts +5 -0
  25. package/src/api/events/externalApplication.js +2 -0
  26. package/src/api/events/frame.d.ts +9 -0
  27. package/src/api/events/frame.js +2 -0
  28. package/src/api/events/globalHotkey.d.ts +10 -0
  29. package/src/api/events/globalHotkey.js +2 -0
  30. package/src/api/events/platform.d.ts +18 -0
  31. package/src/api/events/platform.js +2 -0
  32. package/src/api/events/system.d.ts +22 -0
  33. package/src/api/events/system.js +2 -0
  34. package/src/api/events/view.d.ts +56 -0
  35. package/src/api/events/view.js +2 -0
  36. package/src/api/events/webcontents.d.ts +48 -0
  37. package/src/api/events/webcontents.js +2 -0
  38. package/src/api/events/window.d.ts +176 -0
  39. package/src/api/events/window.js +2 -0
  40. package/src/api/external-application/Factory.d.ts +26 -26
  41. package/src/api/external-application/Factory.js +40 -40
  42. package/src/api/external-application/Instance.d.ts +101 -102
  43. package/src/api/external-application/Instance.js +109 -109
  44. package/src/api/external-application/index.d.ts +3 -3
  45. package/src/api/external-application/index.js +15 -15
  46. package/src/api/fin.d.ts +49 -49
  47. package/src/api/fin.js +43 -43
  48. package/src/api/frame/Factory.d.ts +36 -36
  49. package/src/api/frame/Factory.js +69 -69
  50. package/src/api/frame/Instance.d.ts +121 -121
  51. package/src/api/frame/Instance.js +130 -130
  52. package/src/api/frame/index.d.ts +3 -3
  53. package/src/api/frame/index.js +15 -15
  54. package/src/api/global-hotkey/index.d.ts +38 -38
  55. package/src/api/global-hotkey/index.js +58 -58
  56. package/src/api/interappbus/channel/channel.d.ts +26 -26
  57. package/src/api/interappbus/channel/channel.js +77 -77
  58. package/src/api/interappbus/channel/channels-docs.d.ts +318 -318
  59. package/src/api/interappbus/channel/channels-docs.js +376 -376
  60. package/src/api/interappbus/channel/client.d.ts +22 -22
  61. package/src/api/interappbus/channel/client.js +84 -84
  62. package/src/api/interappbus/channel/connection-manager.d.ts +28 -28
  63. package/src/api/interappbus/channel/connection-manager.js +244 -244
  64. package/src/api/interappbus/channel/index.d.ts +22 -23
  65. package/src/api/interappbus/channel/index.js +121 -121
  66. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -13
  67. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -73
  68. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -22
  69. package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -84
  70. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -20
  71. package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -58
  72. package/src/api/interappbus/channel/protocols/index.d.ts +44 -44
  73. package/src/api/interappbus/channel/protocols/index.js +2 -2
  74. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -10
  75. package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -43
  76. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -23
  77. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -135
  78. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -30
  79. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -131
  80. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -22
  81. package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -87
  82. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -13
  83. package/src/api/interappbus/channel/protocols/strategy-types.js +2 -2
  84. package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -15
  85. package/src/api/interappbus/channel/protocols/strategy.js +2 -2
  86. package/src/api/interappbus/channel/provider.d.ts +31 -31
  87. package/src/api/interappbus/channel/provider.js +160 -160
  88. package/src/api/interappbus/index.d.ts +85 -86
  89. package/src/api/interappbus/index.js +175 -175
  90. package/src/api/interop/Factory.d.ts +37 -37
  91. package/src/api/interop/Factory.js +54 -54
  92. package/src/api/interop/InteropBroker.d.ts +363 -363
  93. package/src/api/interop/InteropBroker.js +914 -914
  94. package/src/api/interop/InteropClient.d.ts +268 -268
  95. package/src/api/interop/InteropClient.js +450 -450
  96. package/src/api/interop/SessionContextGroupBroker.d.ts +26 -26
  97. package/src/api/interop/SessionContextGroupBroker.js +107 -107
  98. package/src/api/interop/SessionContextGroupClient.d.ts +20 -20
  99. package/src/api/interop/SessionContextGroupClient.js +85 -85
  100. package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -187
  101. package/src/api/interop/fdc3/fdc3-1.2.js +385 -385
  102. package/src/api/interop/fdc3/fdc3.js +17 -17
  103. package/src/api/interop/fdc3/utils.d.ts +6 -6
  104. package/src/api/interop/fdc3/utils.js +17 -17
  105. package/src/api/interop/index.d.ts +4 -4
  106. package/src/api/interop/index.js +16 -16
  107. package/src/api/interop/utils.d.ts +11 -11
  108. package/src/api/interop/utils.js +36 -36
  109. package/src/api/me.d.ts +38 -35
  110. package/src/api/me.js +128 -60
  111. package/src/api/platform/Factory.d.ts +109 -109
  112. package/src/api/platform/Factory.js +188 -188
  113. package/src/api/platform/Instance.d.ts +122 -122
  114. package/src/api/platform/Instance.js +298 -298
  115. package/src/api/platform/common-utils.d.ts +6 -6
  116. package/src/api/platform/common-utils.js +16 -16
  117. package/src/api/platform/index.d.ts +3 -3
  118. package/src/api/platform/index.js +15 -15
  119. package/src/api/platform/layout/Factory.d.ts +108 -108
  120. package/src/api/platform/layout/Factory.js +189 -189
  121. package/src/api/platform/layout/Instance.d.ts +49 -49
  122. package/src/api/platform/layout/Instance.js +99 -99
  123. package/src/api/platform/layout/index.d.ts +2 -2
  124. package/src/api/platform/layout/index.js +14 -14
  125. package/src/api/platform/layout/shapes.d.ts +11 -0
  126. package/src/api/{window → platform/layout}/shapes.js +2 -2
  127. package/src/api/snapshot-source/Factory.d.ts +36 -36
  128. package/src/api/snapshot-source/Factory.js +65 -65
  129. package/src/api/snapshot-source/Instance.d.ts +30 -30
  130. package/src/api/snapshot-source/Instance.js +134 -134
  131. package/src/api/snapshot-source/index.d.ts +3 -3
  132. package/src/api/snapshot-source/index.js +15 -15
  133. package/src/api/snapshot-source/utils.d.ts +1 -1
  134. package/src/api/snapshot-source/utils.js +5 -5
  135. package/src/api/system/index.d.ts +960 -961
  136. package/src/api/system/index.js +1241 -1241
  137. package/src/api/view/Factory.d.ts +49 -49
  138. package/src/api/view/Factory.js +103 -103
  139. package/src/api/view/Instance.d.ts +387 -380
  140. package/src/api/view/Instance.js +422 -415
  141. package/src/api/view/index.d.ts +3 -3
  142. package/src/api/view/index.js +15 -15
  143. package/src/api/webcontents/main.d.ts +36 -36
  144. package/src/api/webcontents/main.js +82 -82
  145. package/src/api/window/Factory.d.ts +44 -44
  146. package/src/api/window/Factory.js +91 -91
  147. package/src/api/window/Instance.d.ts +972 -966
  148. package/src/api/window/Instance.js +1209 -1202
  149. package/src/api/window/index.d.ts +3 -5
  150. package/src/api/window/index.js +15 -17
  151. package/src/environment/environment.d.ts +28 -25
  152. package/src/environment/environment.js +4 -4
  153. package/src/environment/node-env.d.ts +25 -26
  154. package/src/environment/node-env.js +64 -64
  155. package/src/environment/openfin-env.d.ts +29 -30
  156. package/src/environment/openfin-env.js +107 -107
  157. package/src/mock.d.ts +3 -3
  158. package/src/mock.js +91 -90
  159. package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -0
  160. package/src/shapes/ERROR_BOX_TYPES.js +2 -0
  161. package/src/shapes/WebOptions.d.ts +12 -0
  162. package/src/shapes/WebOptions.js +2 -0
  163. package/src/shapes/WindowOptions.d.ts +42 -0
  164. package/src/shapes/WindowOptions.js +2 -0
  165. package/src/shapes/protocol.d.ts +178 -0
  166. package/src/shapes/protocol.js +2 -0
  167. package/src/transport/fin_store.d.ts +4 -4
  168. package/src/transport/fin_store.js +16 -16
  169. package/src/transport/transport-errors.d.ts +18 -18
  170. package/src/transport/transport-errors.js +37 -37
  171. package/src/transport/transport.d.ts +56 -43
  172. package/src/transport/transport.js +181 -181
  173. package/src/transport/wire.d.ts +71 -11
  174. package/src/transport/wire.js +32 -32
  175. package/src/util/asyncFilter.d.ts +1 -1
  176. package/src/util/asyncFilter.js +7 -7
  177. package/src/util/errors.d.ts +9 -5
  178. package/src/util/errors.js +11 -11
  179. package/src/util/exhaustive.d.ts +1 -1
  180. package/src/util/exhaustive.js +7 -7
  181. package/src/util/http.d.ts +11 -11
  182. package/src/util/http.js +83 -83
  183. package/src/util/normalize-config.d.ts +3 -5
  184. package/src/util/normalize-config.js +47 -47
  185. package/src/util/promises.d.ts +5 -5
  186. package/src/util/promises.js +27 -27
  187. package/src/util/ref-counter.d.ts +7 -7
  188. package/src/util/ref-counter.js +51 -51
  189. package/src/util/runtimeVersioning.d.ts +3 -3
  190. package/src/util/runtimeVersioning.js +25 -25
  191. package/src/util/utilTypes.d.ts +8 -8
  192. package/src/util/utilTypes.js +2 -2
  193. package/src/util/validate.d.ts +3 -3
  194. package/src/util/validate.js +11 -11
  195. package/docs.README(OLD).md +0 -82
  196. package/resources/win/OpenFinRVM.exe +0 -0
  197. package/src/api/window/bounds-changed.d.ts +0 -10
  198. package/src/api/window/bounds-changed.js +0 -6
  199. package/src/api/window/shapes.d.ts +0 -13
@@ -1,415 +1,422 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.View = void 0;
4
- /* eslint-disable import/prefer-default-export */
5
- const main_1 = require("../webcontents/main");
6
- const window_1 = require("../window");
7
- /**
8
- * @typedef {object} View~options
9
- * @summary View creation options.
10
- * @desc This is the options object required by {@link View.create View.create}.
11
- *
12
- * Note that `name` and `target` are the only required properties — albeit the `url` property is usually provided as well
13
- * (defaults to `"about:blank"` when omitted).
14
- *
15
- * @property {object} [experimental]
16
- * Configurations for API injection.
17
- *
18
- * @property {boolean} [experimental.childWindows] Configure if the runtime should enable child windows for views.
19
- *
20
- * @property {object} [api]
21
- * Configurations for API injection.
22
- *
23
- * @property {object} [api.iframe] Configure if the the API should be injected into iframes based on domain.
24
- *
25
- * @property {boolean} [api.iframe.crossOriginInjection=false] Controls if the `fin` API object is present for cross origin iframes.
26
- * @property {boolean} [api.iframe.sameOriginInjection=true] Controls if the `fin` API object is present for same origin iframes.
27
- *
28
- * @property {object} [autoResize] AutoResize options
29
- *
30
- * @property {object} [bounds] initial bounds given relative to the window.
31
- *
32
- * @property {string} [backgroundColor="#FFF"] - _Updatable._
33
- * The view’s _backfill_ color as a hexadecimal value. Not to be confused with the content background color
34
- * (`document.body.style.backgroundColor`),
35
- * this color briefly fills a view’s (a) content area before its content is loaded as well as (b) newly exposed
36
- * areas when growing a window. Setting
37
- * this value to the anticipated content background color can help improve user experience.
38
- * Default is white.
39
- *
40
- * @property {object} [contentNavigation]
41
- * Restrict navigation to URLs that match a whitelisted pattern.
42
- * In the lack of a whitelist, navigation to URLs that match a blacklisted pattern would be prohibited.
43
- * See [here](https://developer.chrome.com/extensions/match_patterns) for more details.
44
- * @property {string[]} [contentNavigation.whitelist=[]] List of whitelisted URLs.
45
- * @property {string[]} [contentNavigation.blacklist=[]] List of blacklisted URLs.
46
- *
47
- * @property {object} [contextMenuSettings] - _Updatable._
48
- * Configure the context menu when right-clicking on a view.
49
- * @property {boolean} [contextMenuSettings.enable=true] Should the context menu display on right click.
50
- * @property {boolean} [contextMenuSettings.devtools=true] Should the context menu contain a button for opening devtools.
51
- * @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
52
- *
53
- * @property {any} [customData=""] - _Updatable._
54
- * A field that the user can attach serializable data to to be ferried around with the view options.
55
- * _When omitted, the default value of this property is the empty string (`""`)._
56
- *
57
- * When omitted, the default value of this property is the empty string (`""`).
58
- * As opposed to customData this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
59
- *
60
- * @property {object[]} [hotkeys=[]] - _Updatable._
61
- * Defines the list of hotkeys that will be emitted as a `hotkey` event on the view. For usage example see [example]{@tutorial hotkeys}.
62
- * Within Platform, OpenFin also implements a set of pre-defined actions called
63
- * [keyboard commands]{@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands}
64
- * that can be assigned to a specific hotkey in the platform manifest.
65
- * @property {string} hotkeys.keys The key combination of the hotkey, i.e. "Ctrl+T"
66
- * @property {boolean} [hotkeys.preventDefault=false] preventDefault will prevent the page keydown/keyup events from being emitted.
67
- *
68
- * @property {boolean} [isClosable=true] **Platforms Only.** If false, the view will be persistent and can't be closed through
69
- * either UI or `Platform.closeView`. Note that the view will still be closed if the host window is closed or
70
- * if the view isn't part of the new layout when running `Layout.replace`.
71
- *
72
- * @property {string} name
73
- * The name of the view.
74
- *
75
- * @property {boolean} [detachOnClose=false] - _Updatable._
76
- * Platforms Only. If true, will hide and detach the View from the window for later use instead of closing,
77
- * allowing the state of the View to be saved and the View to be immediately shown in a new Layout.
78
- *
79
- * @property {string} [manifestUrl] **Platforms Only.** Url to a manifest that contains View Options. Properties other than manifestUrl can still be used
80
- * but the properties in the manifest will take precedence if there is any collision.
81
- *
82
- * @property {preloadScript[]} [preloadScripts] - _Inheritable_
83
- * A list of scripts that are eval'ed before other scripts in the page. When omitted, _inherits_
84
- * from the parent application.
85
- *
86
- * @property {boolean} [preventDragOut=false] **Platforms Only.** If true, the tab of the view can't be dragged out of its host window.
87
- *
88
- * @property {string} [processAffinity=<application uuid>]
89
- * A string to attempt to group renderers together. Will only be used if pages are on the same origin.
90
- *
91
- * @property {Identity} [target]
92
- * The identity of the window this view should be attached to.
93
- *
94
- * @property {string} [url="about:blank"]
95
- * The URL of the view.
96
- *
97
- * @property {string} [uuid=<application uuid>]
98
- * The `uuid` of the application, unique within the set of all `Application`s running in OpenFin Runtime.
99
- * If omitted, defaults to the `uuid` of the application spawning the view.
100
- * If given, must match the `uuid` of the application spawning the view.
101
- * In other words, the application's `uuid` is the only acceptable value, but is the default, so there's
102
- * really no need to provide it.
103
- */
104
- /**
105
- * @classdesc a View can be used to embed additional web content into a Window.
106
- * It is like a child window, except it is positioned relative to its owning window.
107
- * It has the ability to listen for <a href="tutorial-View.EventEmitter.html">View-specific events</a>.
108
- *
109
- * By default, a View will try to share the same renderer process as other Views owned by its parent Application.
110
- * To change that behavior, see the processAffinity {@link View~options view option}.
111
- *
112
- * A View's lifecycle is tied to its owning window and can be re-attached to a different window at any point during its lifecycle.
113
- * @class
114
- * @alias View
115
- * @hideconstructor
116
- */
117
- class View extends main_1.WebContents {
118
- constructor(wire, identity) {
119
- super(wire, identity, 'view');
120
- this.identity = identity;
121
- /**
122
- * Returns the zoom level of the view.
123
- * @function getZoomLevel
124
- * @memberOf View
125
- * @instance
126
- * @return {Promise.<number>}
127
- * @tutorial View.getZoomLevel
128
- */
129
- /**
130
- * Sets the zoom level of the view.
131
- * @param { number } level The zoom level
132
- * @function setZoomLevel
133
- * @memberOf View
134
- * @instance
135
- * @return {Promise.<void>}
136
- * @tutorial View.setZoomLevel
137
- */
138
- /**
139
- * Find and highlight text on a page.
140
- * @param { string } searchTerm Term to find in page
141
- * @param { FindInPageOptions } options Search options
142
- * @function findInPage
143
- * @memberOf View
144
- * @instance
145
- * @return {Promise.<number>}
146
- * @tutorial View.findInPage
147
- */
148
- /**
149
- * Stops any findInPage call with the provided action.
150
- * @param {string} action
151
- * Action to execute when stopping a find in page:<br>
152
- * "clearSelection" - Clear the selection.<br>
153
- * "keepSelection" - Translate the selection into a normal selection.<br>
154
- * "activateSelection" - Focus and click the selection node.<br>
155
- * @function stopFindInPage
156
- * @memberOf View
157
- * @instance
158
- * @return {Promise.<void>}
159
- * @tutorial View.stopFindInPage
160
- */
161
- /**
162
- * Navigates the view to a specified URL. The url must contain the protocol prefix such as http:// or https://.
163
- * @param { string } url - The URL to navigate the view to.
164
- * @return {Promise.<void>}
165
- * @function navigate
166
- * @memberof View
167
- * @instance
168
- * @tutorial View.navigate
169
- * @experimental
170
- */
171
- /**
172
- * Navigates the view back one page.
173
- * @function navigateBack
174
- * @memberOf View
175
- * @instance
176
- * @return {Promise.<void>}
177
- * @tutorial View.navigateBack
178
- */
179
- /**
180
- * Navigates the view forward one page.
181
- * @function navigateForward
182
- * @memberOf View
183
- * @instance
184
- * @return {Promise.<void>}
185
- * @tutorial View.navigateForward
186
- */
187
- /**
188
- * Stops any current navigation the view is performing.
189
- * @function stopNavigation
190
- * @memberOf View
191
- * @instance
192
- * @return {Promise.<void>}
193
- * @tutorial View.stopNavigation
194
- */
195
- /**
196
- * Reloads the view current page
197
- * @function reload
198
- * @memberOf View
199
- * @instance
200
- * @return {Promise.<void>}
201
- * @tutorial View.reload
202
- */
203
- /**
204
- * Prints the view's web page
205
- * @param { PrintOptions } [options] Printer Options
206
- * @function print
207
- * @memberOf View
208
- * @instance
209
- * @return {Promise.<void>}
210
- * @tutorial View.print
211
- */
212
- /**
213
- * Returns an array with all system printers
214
- * @function getPrinters
215
- * @memberOf View
216
- * @instance
217
- * @return { Promise.Array.<PrinterInfo> }
218
- * @tutorial View.getPrinters
219
- */
220
- /**
221
- * Shows the Chromium Developer Tools
222
- * @function showDeveloperTools
223
- * @memberOf View
224
- * @instance
225
- * @return {Promise.<void>}
226
- * @tutorial View.showDeveloperTools
227
- */
228
- /**
229
- * Retrieves the process information associated with a view.
230
- * @function getProcessInfo
231
- * @memberOf View
232
- * @instance
233
- * @return {Promise.<EntityProcessDetails>}
234
- * @tutorial View.getProcessInfo
235
- */
236
- /**
237
- * Retrieves information on all Shared Workers.
238
- * @function getSharedWorkers
239
- * @memberOf View
240
- * @instance
241
- * @return {Promise.Array.<SharedWorkerInfo>}
242
- * @tutorial View.getSharedWorkers
243
- */
244
- /**
245
- * Opens the developer tools for the shared worker context.
246
- * @function inspectSharedWorker
247
- * @memberOf View
248
- * @instance
249
- * @return {Promise.<void>}
250
- * @tutorial View.inspectSharedWorker
251
- */
252
- /**
253
- * Inspects the shared worker based on its ID.
254
- * @param { string } workerId - The id of the shared worker.
255
- * @function inspectSharedWorkerById
256
- * @memberOf View
257
- * @instance
258
- * @return {Promise.<void>}
259
- * @tutorial View.inspectSharedWorkerById
260
- */
261
- /**
262
- * Opens the developer tools for the service worker context.
263
- * @function inspectServiceWorker
264
- * @memberOf View
265
- * @instance
266
- * @return {Promise.<void>}
267
- * @tutorial View.inspectServiceWorker
268
- */
269
- /**
270
- * Attaches the current view to a the given window identity.
271
- * Identity must be the identity of a window in the same application.
272
- * This detaches the view from its current window, and sets the view to be destroyed when its new window closes.
273
- * @param target {Identity}
274
- * @return {Promise.<void>}
275
- * @tutorial View.attach
276
- * @experimental
277
- */
278
- this.attach = async (target) => {
279
- await this.wire.sendAction('attach-view', { target, ...this.identity });
280
- };
281
- /**
282
- * Destroys the current view
283
- * @return {Promise.<void>}
284
- * @tutorial View.destroy
285
- * @experimental
286
- */
287
- this.destroy = async () => {
288
- await this.wire.sendAction('destroy-view', { ...this.identity });
289
- };
290
- /**
291
- * Shows the current view if it is currently hidden.
292
- * @return {Promise.<void>}
293
- * @tutorial View.show
294
- * @experimental
295
- */
296
- this.show = async () => {
297
- await this.wire.sendAction('show-view', { ...this.identity });
298
- };
299
- /**
300
- * Hides the current view if it is currently visible.
301
- * @return {Promise.<void>}
302
- * @tutorial View.hide
303
- * @experimental
304
- */
305
- this.hide = async () => {
306
- await this.wire.sendAction('hide-view', { ...this.identity });
307
- };
308
- /**
309
- * Sets the bounds (top, left, width, height) of the view relative to its window.
310
- * @param bounds {ViewBounds}
311
- * @return {Promise.<void>}
312
- * @tutorial View.setBounds
313
- * @experimental
314
- */
315
- this.setBounds = async (bounds) => {
316
- await this.wire.sendAction('set-view-bounds', { bounds, ...this.identity });
317
- };
318
- /**
319
- * Gets the bounds (top, left, width, height) of the view relative to its window.
320
- * @return {Promise.<ViewBounds>}
321
- * @tutorial View.getBounds
322
- * @experimental
323
- */
324
- this.getBounds = async () => {
325
- const ack = await this.wire.sendAction('get-view-bounds', { ...this.identity });
326
- return ack.payload.data;
327
- };
328
- /**
329
- * Gets the View's info.
330
- * @return {Promise.<ViewInfo>}
331
- * @tutorial View.getInfo
332
- * @experimental
333
- */
334
- this.getInfo = async () => {
335
- const ack = await this.wire.sendAction('get-view-info', { ...this.identity });
336
- return ack.payload.data;
337
- };
338
- /**
339
- * Retrieves the layout for the window the view is attached to.
340
- * @return {Promise.<Layout>}
341
- * @tutorial View.getParentLayout
342
- * @experimental
343
- */
344
- this.getParentLayout = async () => {
345
- this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch((e) => {
346
- // don't expose
347
- });
348
- const currentWindow = await this.getCurrentWindow();
349
- return currentWindow.getLayout();
350
- };
351
- /**
352
- * Gets the View's options.
353
- * @return {Promise<ViewOptions>}
354
- * @tutorial View.getOptions
355
- * @experimental
356
- */
357
- this.getOptions = async () => {
358
- return this.wire.sendAction('get-view-options', { ...this.identity }).then(({ payload }) => payload.data);
359
- };
360
- /**
361
- * Updates the view's options.
362
- * @param { Partial<ViewOptions> } options
363
- * @return {Promise.<void>}
364
- * @tutorial View.updateOptions
365
- * @experimental
366
- */
367
- this.updateOptions = async (options) => {
368
- return this.wire.sendAction('update-view-options', { options, ...this.identity }).then(() => undefined);
369
- };
370
- /**
371
- * Retrieves the window the view is currently attached to.
372
- * @return {Promise.<_Window>}
373
- * @experimental
374
- */
375
- this.getCurrentWindow = async () => {
376
- const { payload: { data } } = await this.wire.sendAction('get-view-window', { ...this.identity });
377
- return new window_1._Window(this.wire, data);
378
- };
379
- }
380
- /**
381
- * Gets a base64 encoded image of the view or a part of it.
382
- * @function capturePage
383
- * @param { CapturePageOptions } [options] Options for the capturePage call.
384
- * @memberOf View
385
- * @instance
386
- * @return {Promise.<string>}
387
- * @tutorial View.capturePage
388
- */
389
- /**
390
- * Executes Javascript on the view, restricted to contents you own or contents owned by
391
- * applications you have created.
392
- * @param { string } code JavaScript code to be executed on the view.
393
- * @function executeJavaScript
394
- * @memberOf View
395
- * @instance
396
- * @return {Promise.<void>}
397
- * @tutorial View.executeJavaScript
398
- */
399
- /**
400
- * Focuses the view
401
- * @return {Promise.<void>}
402
- * @function focus
403
- * @memberof View
404
- * @emits focused
405
- * @instance
406
- * @tutorial View.focus
407
- * @experimental
408
- */
409
- async focus({ emitSynthFocused } = { emitSynthFocused: true }) {
410
- const win = await this.getCurrentWindow();
411
- await win.focusedWebViewWasChanged();
412
- await super.focus({ emitSynthFocused });
413
- }
414
- }
415
- exports.View = View;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.View = void 0;
4
+ /* eslint-disable import/prefer-default-export */
5
+ const main_1 = require("../webcontents/main");
6
+ const window_1 = require("../window");
7
+ /**
8
+ * @typedef {object} View~options
9
+ * @summary View creation options.
10
+ * @desc This is the options object required by {@link View.create View.create}.
11
+ *
12
+ * Note that `name` and `target` are the only required properties — albeit the `url` property is usually provided as well
13
+ * (defaults to `"about:blank"` when omitted).
14
+ *
15
+ * @property {object} [experimental]
16
+ * Configurations for API injection.
17
+ *
18
+ * @property {boolean} [experimental.childWindows] Configure if the runtime should enable child windows for views.
19
+ *
20
+ * @property {object} [api]
21
+ * Configurations for API injection.
22
+ *
23
+ * @property {object} [api.iframe] Configure if the the API should be injected into iframes based on domain.
24
+ *
25
+ * @property {boolean} [api.iframe.crossOriginInjection=false] Controls if the `fin` API object is present for cross origin iframes.
26
+ * @property {boolean} [api.iframe.sameOriginInjection=true] Controls if the `fin` API object is present for same origin iframes.
27
+ *
28
+ * @property {object} [autoResize] AutoResize options
29
+ *
30
+ * @property {object} [bounds] initial bounds given relative to the window.
31
+ *
32
+ * @property {string} [backgroundColor="#FFF"] - _Updatable._
33
+ * The view’s _backfill_ color as a hexadecimal value. Not to be confused with the content background color
34
+ * (`document.body.style.backgroundColor`),
35
+ * this color briefly fills a view’s (a) content area before its content is loaded as well as (b) newly exposed
36
+ * areas when growing a window. Setting
37
+ * this value to the anticipated content background color can help improve user experience.
38
+ * Default is white.
39
+ *
40
+ * @property {object} [contentNavigation]
41
+ * Restrict navigation to URLs that match a whitelisted pattern.
42
+ * In the lack of a whitelist, navigation to URLs that match a blacklisted pattern would be prohibited.
43
+ * See [here](https://developer.chrome.com/extensions/match_patterns) for more details.
44
+ * @property {string[]} [contentNavigation.whitelist=[]] List of whitelisted URLs.
45
+ * @property {string[]} [contentNavigation.blacklist=[]] List of blacklisted URLs.
46
+ *
47
+ * @property {object} [contentRedirect]
48
+ * Restrict redirects to URLs that match a whitelisted pattern.
49
+ * In the lack of a whitelist, redirects to URLs that match a blacklisted pattern would be prohibited.
50
+ * See [here](https://developer.chrome.com/extensions/match_patterns) for more details.
51
+ * @property {string[]} [contentRedirect.whitelist=[]] List of whitelisted URLs.
52
+ * @property {string[]} [contentRedirect.blacklist=[]] List of blacklisted URLs.
53
+ *
54
+ * @property {object} [contextMenuSettings] - _Updatable._
55
+ * Configure the context menu when right-clicking on a view.
56
+ * @property {boolean} [contextMenuSettings.enable=true] Should the context menu display on right click.
57
+ * @property {boolean} [contextMenuSettings.devtools=true] Should the context menu contain a button for opening devtools.
58
+ * @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
59
+ *
60
+ * @property {any} [customData=""] - _Updatable._
61
+ * A field that the user can attach serializable data to to be ferried around with the view options.
62
+ * _When omitted, the default value of this property is the empty string (`""`)._
63
+ *
64
+ * When omitted, the default value of this property is the empty string (`""`).
65
+ * As opposed to customData this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext}
66
+ *
67
+ * @property {object[]} [hotkeys=[]] - _Updatable._
68
+ * Defines the list of hotkeys that will be emitted as a `hotkey` event on the view. For usage example see [example]{@tutorial hotkeys}.
69
+ * Within Platform, OpenFin also implements a set of pre-defined actions called
70
+ * [keyboard commands]{@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands}
71
+ * that can be assigned to a specific hotkey in the platform manifest.
72
+ * @property {string} hotkeys.keys The key combination of the hotkey, i.e. "Ctrl+T"
73
+ * @property {boolean} [hotkeys.preventDefault=false] preventDefault will prevent the page keydown/keyup events from being emitted.
74
+ *
75
+ * @property {boolean} [isClosable=true] **Platforms Only.** If false, the view will be persistent and can't be closed through
76
+ * either UI or `Platform.closeView`. Note that the view will still be closed if the host window is closed or
77
+ * if the view isn't part of the new layout when running `Layout.replace`.
78
+ *
79
+ * @property {string} name
80
+ * The name of the view.
81
+ *
82
+ * @property {boolean} [detachOnClose=false] - _Updatable._
83
+ * Platforms Only. If true, will hide and detach the View from the window for later use instead of closing,
84
+ * allowing the state of the View to be saved and the View to be immediately shown in a new Layout.
85
+ *
86
+ * @property {string} [manifestUrl] **Platforms Only.** Url to a manifest that contains View Options. Properties other than manifestUrl can still be used
87
+ * but the properties in the manifest will take precedence if there is any collision.
88
+ *
89
+ * @property {preloadScript[]} [preloadScripts] - _Inheritable_
90
+ * A list of scripts that are eval'ed before other scripts in the page. When omitted, _inherits_
91
+ * from the parent application.
92
+ *
93
+ * @property {boolean} [preventDragOut=false] **Platforms Only.** If true, the tab of the view can't be dragged out of its host window.
94
+ *
95
+ * @property {string} [processAffinity=<application uuid>]
96
+ * A string to attempt to group renderers together. Will only be used if pages are on the same origin.
97
+ *
98
+ * @property {Identity} [target]
99
+ * The identity of the window this view should be attached to.
100
+ *
101
+ * @property {string} [url="about:blank"]
102
+ * The URL of the view.
103
+ *
104
+ * @property {string} [uuid=<application uuid>]
105
+ * The `uuid` of the application, unique within the set of all `Application`s running in OpenFin Runtime.
106
+ * If omitted, defaults to the `uuid` of the application spawning the view.
107
+ * If given, must match the `uuid` of the application spawning the view.
108
+ * In other words, the application's `uuid` is the only acceptable value, but is the default, so there's
109
+ * really no need to provide it.
110
+ */
111
+ /**
112
+ * @classdesc a View can be used to embed additional web content into a Window.
113
+ * It is like a child window, except it is positioned relative to its owning window.
114
+ * It has the ability to listen for <a href="tutorial-View.EventEmitter.html">View-specific events</a>.
115
+ *
116
+ * By default, a View will try to share the same renderer process as other Views owned by its parent Application.
117
+ * To change that behavior, see the processAffinity {@link View~options view option}.
118
+ *
119
+ * A View's lifecycle is tied to its owning window and can be re-attached to a different window at any point during its lifecycle.
120
+ * @class
121
+ * @alias View
122
+ * @hideconstructor
123
+ */
124
+ class View extends main_1.WebContents {
125
+ constructor(wire, identity) {
126
+ super(wire, identity, 'view');
127
+ this.identity = identity;
128
+ /**
129
+ * Returns the zoom level of the view.
130
+ * @function getZoomLevel
131
+ * @memberOf View
132
+ * @instance
133
+ * @return {Promise.<number>}
134
+ * @tutorial View.getZoomLevel
135
+ */
136
+ /**
137
+ * Sets the zoom level of the view.
138
+ * @param { number } level The zoom level
139
+ * @function setZoomLevel
140
+ * @memberOf View
141
+ * @instance
142
+ * @return {Promise.<void>}
143
+ * @tutorial View.setZoomLevel
144
+ */
145
+ /**
146
+ * Find and highlight text on a page.
147
+ * @param { string } searchTerm Term to find in page
148
+ * @param { FindInPageOptions } options Search options
149
+ * @function findInPage
150
+ * @memberOf View
151
+ * @instance
152
+ * @return {Promise.<number>}
153
+ * @tutorial View.findInPage
154
+ */
155
+ /**
156
+ * Stops any findInPage call with the provided action.
157
+ * @param {string} action
158
+ * Action to execute when stopping a find in page:<br>
159
+ * "clearSelection" - Clear the selection.<br>
160
+ * "keepSelection" - Translate the selection into a normal selection.<br>
161
+ * "activateSelection" - Focus and click the selection node.<br>
162
+ * @function stopFindInPage
163
+ * @memberOf View
164
+ * @instance
165
+ * @return {Promise.<void>}
166
+ * @tutorial View.stopFindInPage
167
+ */
168
+ /**
169
+ * Navigates the view to a specified URL. The url must contain the protocol prefix such as http:// or https://.
170
+ * @param { string } url - The URL to navigate the view to.
171
+ * @return {Promise.<void>}
172
+ * @function navigate
173
+ * @memberof View
174
+ * @instance
175
+ * @tutorial View.navigate
176
+ * @experimental
177
+ */
178
+ /**
179
+ * Navigates the view back one page.
180
+ * @function navigateBack
181
+ * @memberOf View
182
+ * @instance
183
+ * @return {Promise.<void>}
184
+ * @tutorial View.navigateBack
185
+ */
186
+ /**
187
+ * Navigates the view forward one page.
188
+ * @function navigateForward
189
+ * @memberOf View
190
+ * @instance
191
+ * @return {Promise.<void>}
192
+ * @tutorial View.navigateForward
193
+ */
194
+ /**
195
+ * Stops any current navigation the view is performing.
196
+ * @function stopNavigation
197
+ * @memberOf View
198
+ * @instance
199
+ * @return {Promise.<void>}
200
+ * @tutorial View.stopNavigation
201
+ */
202
+ /**
203
+ * Reloads the view current page
204
+ * @function reload
205
+ * @memberOf View
206
+ * @instance
207
+ * @return {Promise.<void>}
208
+ * @tutorial View.reload
209
+ */
210
+ /**
211
+ * Prints the view's web page
212
+ * @param { PrintOptions } [options] Printer Options
213
+ * @function print
214
+ * @memberOf View
215
+ * @instance
216
+ * @return {Promise.<void>}
217
+ * @tutorial View.print
218
+ */
219
+ /**
220
+ * Returns an array with all system printers
221
+ * @function getPrinters
222
+ * @memberOf View
223
+ * @instance
224
+ * @return { Promise.Array.<PrinterInfo> }
225
+ * @tutorial View.getPrinters
226
+ */
227
+ /**
228
+ * Shows the Chromium Developer Tools
229
+ * @function showDeveloperTools
230
+ * @memberOf View
231
+ * @instance
232
+ * @return {Promise.<void>}
233
+ * @tutorial View.showDeveloperTools
234
+ */
235
+ /**
236
+ * Retrieves the process information associated with a view.
237
+ * @function getProcessInfo
238
+ * @memberOf View
239
+ * @instance
240
+ * @return {Promise.<EntityProcessDetails>}
241
+ * @tutorial View.getProcessInfo
242
+ */
243
+ /**
244
+ * Retrieves information on all Shared Workers.
245
+ * @function getSharedWorkers
246
+ * @memberOf View
247
+ * @instance
248
+ * @return {Promise.Array.<SharedWorkerInfo>}
249
+ * @tutorial View.getSharedWorkers
250
+ */
251
+ /**
252
+ * Opens the developer tools for the shared worker context.
253
+ * @function inspectSharedWorker
254
+ * @memberOf View
255
+ * @instance
256
+ * @return {Promise.<void>}
257
+ * @tutorial View.inspectSharedWorker
258
+ */
259
+ /**
260
+ * Inspects the shared worker based on its ID.
261
+ * @param { string } workerId - The id of the shared worker.
262
+ * @function inspectSharedWorkerById
263
+ * @memberOf View
264
+ * @instance
265
+ * @return {Promise.<void>}
266
+ * @tutorial View.inspectSharedWorkerById
267
+ */
268
+ /**
269
+ * Opens the developer tools for the service worker context.
270
+ * @function inspectServiceWorker
271
+ * @memberOf View
272
+ * @instance
273
+ * @return {Promise.<void>}
274
+ * @tutorial View.inspectServiceWorker
275
+ */
276
+ /**
277
+ * Attaches the current view to a the given window identity.
278
+ * Identity must be the identity of a window in the same application.
279
+ * This detaches the view from its current window, and sets the view to be destroyed when its new window closes.
280
+ * @param target {Identity}
281
+ * @return {Promise.<void>}
282
+ * @tutorial View.attach
283
+ * @experimental
284
+ */
285
+ this.attach = async (target) => {
286
+ await this.wire.sendAction('attach-view', { target, ...this.identity });
287
+ };
288
+ /**
289
+ * Destroys the current view
290
+ * @return {Promise.<void>}
291
+ * @tutorial View.destroy
292
+ * @experimental
293
+ */
294
+ this.destroy = async () => {
295
+ await this.wire.sendAction('destroy-view', { ...this.identity });
296
+ };
297
+ /**
298
+ * Shows the current view if it is currently hidden.
299
+ * @return {Promise.<void>}
300
+ * @tutorial View.show
301
+ * @experimental
302
+ */
303
+ this.show = async () => {
304
+ await this.wire.sendAction('show-view', { ...this.identity });
305
+ };
306
+ /**
307
+ * Hides the current view if it is currently visible.
308
+ * @return {Promise.<void>}
309
+ * @tutorial View.hide
310
+ * @experimental
311
+ */
312
+ this.hide = async () => {
313
+ await this.wire.sendAction('hide-view', { ...this.identity });
314
+ };
315
+ /**
316
+ * Sets the bounds (top, left, width, height) of the view relative to its window.
317
+ * @param bounds {ViewBounds}
318
+ * @return {Promise.<void>}
319
+ * @tutorial View.setBounds
320
+ * @experimental
321
+ */
322
+ this.setBounds = async (bounds) => {
323
+ await this.wire.sendAction('set-view-bounds', { bounds, ...this.identity });
324
+ };
325
+ /**
326
+ * Gets the bounds (top, left, width, height) of the view relative to its window.
327
+ * @return {Promise.<ViewBounds>}
328
+ * @tutorial View.getBounds
329
+ * @experimental
330
+ */
331
+ this.getBounds = async () => {
332
+ const ack = await this.wire.sendAction('get-view-bounds', { ...this.identity });
333
+ return ack.payload.data;
334
+ };
335
+ /**
336
+ * Gets the View's info.
337
+ * @return {Promise.<ViewInfo>}
338
+ * @tutorial View.getInfo
339
+ * @experimental
340
+ */
341
+ this.getInfo = async () => {
342
+ const ack = await this.wire.sendAction('get-view-info', { ...this.identity });
343
+ return ack.payload.data;
344
+ };
345
+ /**
346
+ * Retrieves the layout for the window the view is attached to.
347
+ * @return {Promise.<Layout>}
348
+ * @tutorial View.getParentLayout
349
+ * @experimental
350
+ */
351
+ this.getParentLayout = async () => {
352
+ this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch((e) => {
353
+ // don't expose
354
+ });
355
+ const currentWindow = await this.getCurrentWindow();
356
+ return currentWindow.getLayout();
357
+ };
358
+ /**
359
+ * Gets the View's options.
360
+ * @return {Promise<ViewOptions>}
361
+ * @tutorial View.getOptions
362
+ * @experimental
363
+ */
364
+ this.getOptions = async () => {
365
+ return this.wire.sendAction('get-view-options', { ...this.identity }).then(({ payload }) => payload.data);
366
+ };
367
+ /**
368
+ * Updates the view's options.
369
+ * @param { Partial<ViewOptions> } options
370
+ * @return {Promise.<void>}
371
+ * @tutorial View.updateOptions
372
+ * @experimental
373
+ */
374
+ this.updateOptions = async (options) => {
375
+ return this.wire.sendAction('update-view-options', { options, ...this.identity }).then(() => undefined);
376
+ };
377
+ /**
378
+ * Retrieves the window the view is currently attached to.
379
+ * @return {Promise.<_Window>}
380
+ * @experimental
381
+ */
382
+ this.getCurrentWindow = async () => {
383
+ const { payload: { data } } = await this.wire.sendAction('get-view-window', { ...this.identity });
384
+ return new window_1._Window(this.wire, data);
385
+ };
386
+ }
387
+ /**
388
+ * Gets a base64 encoded image of the view or a part of it.
389
+ * @function capturePage
390
+ * @param { CapturePageOptions } [options] Options for the capturePage call.
391
+ * @memberOf View
392
+ * @instance
393
+ * @return {Promise.<string>}
394
+ * @tutorial View.capturePage
395
+ */
396
+ /**
397
+ * Executes Javascript on the view, restricted to contents you own or contents owned by
398
+ * applications you have created.
399
+ * @param { string } code JavaScript code to be executed on the view.
400
+ * @function executeJavaScript
401
+ * @memberOf View
402
+ * @instance
403
+ * @return {Promise.<void>}
404
+ * @tutorial View.executeJavaScript
405
+ */
406
+ /**
407
+ * Focuses the view
408
+ * @return {Promise.<void>}
409
+ * @function focus
410
+ * @memberof View
411
+ * @emits focused
412
+ * @instance
413
+ * @tutorial View.focus
414
+ * @experimental
415
+ */
416
+ async focus({ emitSynthFocused } = { emitSynthFocused: true }) {
417
+ const win = await this.getCurrentWindow();
418
+ await win.focusedWebViewWasChanged();
419
+ await super.focus({ emitSynthFocused });
420
+ }
421
+ }
422
+ exports.View = View;