@openfin/core 25.68.26

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 (227) hide show
  1. package/LICENSE +13 -0
  2. package/NOTICE +16 -0
  3. package/OpenFin.d.ts +1340 -0
  4. package/README.md +41 -0
  5. package/docs.README(OLD).md +82 -0
  6. package/fin.d.ts +4 -0
  7. package/package.json +33 -0
  8. package/resources/win/OpenFinRVM.exe +0 -0
  9. package/src/api/application/Factory.d.ts +145 -0
  10. package/src/api/application/Factory.js +229 -0
  11. package/src/api/application/Instance.d.ts +302 -0
  12. package/src/api/application/Instance.js +412 -0
  13. package/src/api/application/index.d.ts +3 -0
  14. package/src/api/application/index.js +15 -0
  15. package/src/api/base.d.ts +43 -0
  16. package/src/api/base.js +177 -0
  17. package/src/api/clipboard/index.d.ts +69 -0
  18. package/src/api/clipboard/index.js +88 -0
  19. package/src/api/events/application.d.ts +69 -0
  20. package/src/api/events/application.js +2 -0
  21. package/src/api/events/base.d.ts +17 -0
  22. package/src/api/events/base.js +2 -0
  23. package/src/api/events/channel.d.ts +10 -0
  24. package/src/api/events/channel.js +2 -0
  25. package/src/api/events/emitterMap.d.ts +11 -0
  26. package/src/api/events/emitterMap.js +35 -0
  27. package/src/api/events/eventAggregator.d.ts +5 -0
  28. package/src/api/events/eventAggregator.js +43 -0
  29. package/src/api/events/externalApplication.d.ts +5 -0
  30. package/src/api/events/externalApplication.js +2 -0
  31. package/src/api/events/frame.d.ts +9 -0
  32. package/src/api/events/frame.js +2 -0
  33. package/src/api/events/globalHotkey.d.ts +10 -0
  34. package/src/api/events/globalHotkey.js +2 -0
  35. package/src/api/events/platform.d.ts +18 -0
  36. package/src/api/events/platform.js +2 -0
  37. package/src/api/events/system.d.ts +22 -0
  38. package/src/api/events/system.js +2 -0
  39. package/src/api/events/view.d.ts +56 -0
  40. package/src/api/events/view.js +2 -0
  41. package/src/api/events/webcontents.d.ts +48 -0
  42. package/src/api/events/webcontents.js +2 -0
  43. package/src/api/events/window.d.ts +169 -0
  44. package/src/api/events/window.js +2 -0
  45. package/src/api/external-application/Factory.d.ts +26 -0
  46. package/src/api/external-application/Factory.js +40 -0
  47. package/src/api/external-application/Instance.d.ts +102 -0
  48. package/src/api/external-application/Instance.js +109 -0
  49. package/src/api/external-application/index.d.ts +3 -0
  50. package/src/api/external-application/index.js +15 -0
  51. package/src/api/fin.d.ts +49 -0
  52. package/src/api/fin.js +43 -0
  53. package/src/api/frame/Factory.d.ts +36 -0
  54. package/src/api/frame/Factory.js +69 -0
  55. package/src/api/frame/Instance.d.ts +121 -0
  56. package/src/api/frame/Instance.js +130 -0
  57. package/src/api/frame/index.d.ts +3 -0
  58. package/src/api/frame/index.js +15 -0
  59. package/src/api/global-hotkey/index.d.ts +38 -0
  60. package/src/api/global-hotkey/index.js +58 -0
  61. package/src/api/interappbus/channel/channel.d.ts +26 -0
  62. package/src/api/interappbus/channel/channel.js +77 -0
  63. package/src/api/interappbus/channel/channels-docs.d.ts +318 -0
  64. package/src/api/interappbus/channel/channels-docs.js +376 -0
  65. package/src/api/interappbus/channel/client.d.ts +22 -0
  66. package/src/api/interappbus/channel/client.js +84 -0
  67. package/src/api/interappbus/channel/connection-manager.d.ts +28 -0
  68. package/src/api/interappbus/channel/connection-manager.js +244 -0
  69. package/src/api/interappbus/channel/index.d.ts +22 -0
  70. package/src/api/interappbus/channel/index.js +121 -0
  71. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -0
  72. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -0
  73. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -0
  74. package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -0
  75. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -0
  76. package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -0
  77. package/src/api/interappbus/channel/protocols/index.d.ts +44 -0
  78. package/src/api/interappbus/channel/protocols/index.js +2 -0
  79. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -0
  80. package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -0
  81. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -0
  82. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -0
  83. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -0
  84. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -0
  85. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -0
  86. package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -0
  87. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -0
  88. package/src/api/interappbus/channel/protocols/strategy-types.js +2 -0
  89. package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -0
  90. package/src/api/interappbus/channel/protocols/strategy.js +2 -0
  91. package/src/api/interappbus/channel/provider.d.ts +31 -0
  92. package/src/api/interappbus/channel/provider.js +165 -0
  93. package/src/api/interappbus/index.d.ts +85 -0
  94. package/src/api/interappbus/index.js +175 -0
  95. package/src/api/interop/Factory.d.ts +37 -0
  96. package/src/api/interop/Factory.js +54 -0
  97. package/src/api/interop/InteropBroker.d.ts +363 -0
  98. package/src/api/interop/InteropBroker.js +914 -0
  99. package/src/api/interop/InteropClient.d.ts +268 -0
  100. package/src/api/interop/InteropClient.js +450 -0
  101. package/src/api/interop/SessionContextGroupBroker.d.ts +26 -0
  102. package/src/api/interop/SessionContextGroupBroker.js +107 -0
  103. package/src/api/interop/SessionContextGroupClient.d.ts +20 -0
  104. package/src/api/interop/SessionContextGroupClient.js +85 -0
  105. package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -0
  106. package/src/api/interop/fdc3/fdc3-1.2.js +385 -0
  107. package/src/api/interop/fdc3/fdc3.js +17 -0
  108. package/src/api/interop/fdc3/utils.d.ts +6 -0
  109. package/src/api/interop/fdc3/utils.js +17 -0
  110. package/src/api/interop/index.d.ts +4 -0
  111. package/src/api/interop/index.js +16 -0
  112. package/src/api/interop/utils.d.ts +11 -0
  113. package/src/api/interop/utils.js +36 -0
  114. package/src/api/me.d.ts +35 -0
  115. package/src/api/me.js +60 -0
  116. package/src/api/platform/Factory.d.ts +109 -0
  117. package/src/api/platform/Factory.js +188 -0
  118. package/src/api/platform/Instance.d.ts +122 -0
  119. package/src/api/platform/Instance.js +299 -0
  120. package/src/api/platform/common-utils.d.ts +6 -0
  121. package/src/api/platform/common-utils.js +16 -0
  122. package/src/api/platform/index.d.ts +3 -0
  123. package/src/api/platform/index.js +15 -0
  124. package/src/api/platform/layout/Factory.d.ts +108 -0
  125. package/src/api/platform/layout/Factory.js +189 -0
  126. package/src/api/platform/layout/Instance.d.ts +48 -0
  127. package/src/api/platform/layout/Instance.js +99 -0
  128. package/src/api/platform/layout/index.d.ts +3 -0
  129. package/src/api/platform/layout/index.js +15 -0
  130. package/src/api/platform/layout/shapes.d.ts +11 -0
  131. package/src/api/platform/layout/shapes.js +2 -0
  132. package/src/api/snapshot-source/Factory.d.ts +36 -0
  133. package/src/api/snapshot-source/Factory.js +65 -0
  134. package/src/api/snapshot-source/Instance.d.ts +30 -0
  135. package/src/api/snapshot-source/Instance.js +134 -0
  136. package/src/api/snapshot-source/index.d.ts +3 -0
  137. package/src/api/snapshot-source/index.js +15 -0
  138. package/src/api/snapshot-source/utils.d.ts +1 -0
  139. package/src/api/snapshot-source/utils.js +5 -0
  140. package/src/api/system/application.d.ts +6 -0
  141. package/src/api/system/application.js +2 -0
  142. package/src/api/system/entity.d.ts +11 -0
  143. package/src/api/system/entity.js +2 -0
  144. package/src/api/system/index.d.ts +957 -0
  145. package/src/api/system/index.js +1241 -0
  146. package/src/api/system/installedApps.d.ts +6 -0
  147. package/src/api/system/installedApps.js +2 -0
  148. package/src/api/system/log.d.ts +11 -0
  149. package/src/api/system/log.js +2 -0
  150. package/src/api/system/process.d.ts +15 -0
  151. package/src/api/system/process.js +2 -0
  152. package/src/api/system/proxy.d.ts +15 -0
  153. package/src/api/system/proxy.js +2 -0
  154. package/src/api/system/queryPermissionTypes.d.ts +1 -0
  155. package/src/api/system/queryPermissionTypes.js +2 -0
  156. package/src/api/system/registry-info.d.ts +7 -0
  157. package/src/api/system/registry-info.js +2 -0
  158. package/src/api/system/window.d.ts +16 -0
  159. package/src/api/system/window.js +2 -0
  160. package/src/api/view/Factory.d.ts +49 -0
  161. package/src/api/view/Factory.js +103 -0
  162. package/src/api/view/Instance.d.ts +379 -0
  163. package/src/api/view/Instance.js +415 -0
  164. package/src/api/view/index.d.ts +3 -0
  165. package/src/api/view/index.js +15 -0
  166. package/src/api/webcontents/main.d.ts +36 -0
  167. package/src/api/webcontents/main.js +82 -0
  168. package/src/api/window/Factory.d.ts +44 -0
  169. package/src/api/window/Factory.js +91 -0
  170. package/src/api/window/Instance.d.ts +966 -0
  171. package/src/api/window/Instance.js +1202 -0
  172. package/src/api/window/bounds-changed.d.ts +10 -0
  173. package/src/api/window/bounds-changed.js +6 -0
  174. package/src/api/window/index.d.ts +5 -0
  175. package/src/api/window/index.js +17 -0
  176. package/src/api/window/shapes.d.ts +13 -0
  177. package/src/api/window/shapes.js +2 -0
  178. package/src/environment/environment.d.ts +28 -0
  179. package/src/environment/environment.js +4 -0
  180. package/src/environment/node-env.d.ts +25 -0
  181. package/src/environment/node-env.js +64 -0
  182. package/src/environment/openfin-env.d.ts +29 -0
  183. package/src/environment/openfin-env.js +105 -0
  184. package/src/mock.d.ts +4 -0
  185. package/src/mock.js +91 -0
  186. package/src/shapes/ERROR_BOX_TYPES.d.ts +6 -0
  187. package/src/shapes/ERROR_BOX_TYPES.js +10 -0
  188. package/src/shapes/EntityType.d.ts +1 -0
  189. package/src/shapes/EntityType.js +2 -0
  190. package/src/shapes/LayoutPresetType.d.ts +1 -0
  191. package/src/shapes/LayoutPresetType.js +2 -0
  192. package/src/shapes/Platform.d.ts +112 -0
  193. package/src/shapes/Platform.js +16 -0
  194. package/src/shapes/WebOptions.d.ts +12 -0
  195. package/src/shapes/WebOptions.js +2 -0
  196. package/src/shapes/WindowOptions.d.ts +42 -0
  197. package/src/shapes/WindowOptions.js +2 -0
  198. package/src/shapes/protocol.d.ts +178 -0
  199. package/src/shapes/protocol.js +2 -0
  200. package/src/transport/fin_store.d.ts +4 -0
  201. package/src/transport/fin_store.js +16 -0
  202. package/src/transport/transport-errors.d.ts +17 -0
  203. package/src/transport/transport-errors.js +39 -0
  204. package/src/transport/transport.d.ts +57 -0
  205. package/src/transport/transport.js +195 -0
  206. package/src/transport/wire.d.ts +76 -0
  207. package/src/transport/wire.js +39 -0
  208. package/src/util/asyncFilter.d.ts +1 -0
  209. package/src/util/asyncFilter.js +7 -0
  210. package/src/util/errors.d.ts +9 -0
  211. package/src/util/errors.js +14 -0
  212. package/src/util/exhaustive.d.ts +1 -0
  213. package/src/util/exhaustive.js +7 -0
  214. package/src/util/http.d.ts +11 -0
  215. package/src/util/http.js +83 -0
  216. package/src/util/normalize-config.d.ts +3 -0
  217. package/src/util/normalize-config.js +47 -0
  218. package/src/util/promises.d.ts +5 -0
  219. package/src/util/promises.js +27 -0
  220. package/src/util/ref-counter.d.ts +7 -0
  221. package/src/util/ref-counter.js +51 -0
  222. package/src/util/runtimeVersioning.d.ts +3 -0
  223. package/src/util/runtimeVersioning.js +25 -0
  224. package/src/util/utilTypes.d.ts +8 -0
  225. package/src/util/utilTypes.js +2 -0
  226. package/src/util/validate.d.ts +3 -0
  227. package/src/util/validate.js +11 -0
@@ -0,0 +1,415 @@
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;
@@ -0,0 +1,3 @@
1
+ import ViewModule from './Factory';
2
+ export default ViewModule;
3
+ export * from './Instance';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ }
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ const Factory_1 = require("./Factory");
14
+ exports.default = Factory_1.default;
15
+ __exportStar(require("./Instance"), exports);
@@ -0,0 +1,36 @@
1
+ import { EmitterBase } from '../base';
2
+ import Transport from '../../transport/transport';
3
+ import { WebContentsEventMapping } from '../events/webcontents';
4
+ declare type ImageFormat = 'bmp' | 'jpg' | 'png';
5
+ export interface CapturePageOptions {
6
+ area?: OpenFin.Rectangle;
7
+ format?: ImageFormat;
8
+ quality?: number;
9
+ }
10
+ export declare class WebContents<T extends WebContentsEventMapping> extends EmitterBase<T> {
11
+ entityType: string;
12
+ constructor(wire: Transport, identity: OpenFin.Identity, entityType: string);
13
+ capturePage(options?: CapturePageOptions): Promise<string>;
14
+ executeJavaScript(code: string): Promise<void>;
15
+ getZoomLevel(): Promise<number>;
16
+ setZoomLevel(level: number): Promise<void>;
17
+ navigate(url: string): Promise<void>;
18
+ navigateBack(): Promise<void>;
19
+ navigateForward(): Promise<void>;
20
+ stopNavigation(): Promise<void>;
21
+ reload(ignoreCache?: boolean): Promise<void>;
22
+ print(options?: OpenFin.PrintOptions): Promise<void>;
23
+ findInPage(searchTerm: string, options?: OpenFin.FindInPageOptions): Promise<void>;
24
+ stopFindInPage(action: string): Promise<void>;
25
+ getPrinters(): Promise<OpenFin.PrinterInfo>;
26
+ focus({ emitSynthFocused }?: {
27
+ emitSynthFocused: boolean;
28
+ }): Promise<void>;
29
+ showDeveloperTools(): Promise<void>;
30
+ getProcessInfo(): Promise<OpenFin.EntityProcessDetails>;
31
+ getSharedWorkers(): Promise<OpenFin.SharedWorkerInfo[]>;
32
+ inspectSharedWorker(): Promise<void>;
33
+ inspectSharedWorkerById(workerId: string): Promise<void>;
34
+ inspectServiceWorker(): Promise<void>;
35
+ }
36
+ export {};
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebContents = void 0;
4
+ const base_1 = require("../base");
5
+ class WebContents extends base_1.EmitterBase {
6
+ constructor(wire, identity, entityType) {
7
+ super(wire, entityType, identity.uuid, identity.name);
8
+ this.entityType = entityType;
9
+ }
10
+ capturePage(options) {
11
+ return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
12
+ }
13
+ executeJavaScript(code) {
14
+ return this.wire
15
+ .sendAction('execute-javascript-in-window', { ...this.identity, code })
16
+ .then(({ payload }) => payload.data);
17
+ }
18
+ getZoomLevel() {
19
+ return this.wire.sendAction('get-zoom-level', this.identity).then(({ payload }) => payload.data);
20
+ }
21
+ setZoomLevel(level) {
22
+ return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
23
+ }
24
+ navigate(url) {
25
+ return this.wire.sendAction('navigate-window', { ...this.identity, url }).then(() => undefined);
26
+ }
27
+ navigateBack() {
28
+ return this.wire.sendAction('navigate-window-back', { ...this.identity }).then(() => undefined);
29
+ }
30
+ async navigateForward() {
31
+ await this.wire.sendAction('navigate-window-forward', { ...this.identity });
32
+ }
33
+ stopNavigation() {
34
+ return this.wire.sendAction('stop-window-navigation', { ...this.identity }).then(() => undefined);
35
+ }
36
+ reload(ignoreCache = false) {
37
+ return this.wire
38
+ .sendAction('reload-window', {
39
+ ignoreCache,
40
+ ...this.identity
41
+ })
42
+ .then(() => undefined);
43
+ }
44
+ print(options) {
45
+ return this.wire.sendAction('print', { ...this.identity, options }).then(() => undefined);
46
+ }
47
+ findInPage(searchTerm, options) {
48
+ return this.wire
49
+ .sendAction('find-in-page', { ...this.identity, searchTerm, options })
50
+ .then(({ payload }) => payload.data);
51
+ }
52
+ stopFindInPage(action) {
53
+ return this.wire.sendAction('stop-find-in-page', { ...this.identity, action }).then(() => undefined);
54
+ }
55
+ getPrinters() {
56
+ return this.wire.sendAction('get-printers', { ...this.identity }).then(({ payload }) => payload.data);
57
+ }
58
+ async focus({ emitSynthFocused } = { emitSynthFocused: true }) {
59
+ await this.wire.sendAction('focus-window', { emitSynthFocused, ...this.identity });
60
+ }
61
+ async showDeveloperTools() {
62
+ // Note this hits the system action map in core state for legacy reasons.
63
+ await this.wire.sendAction('show-developer-tools', this.identity);
64
+ }
65
+ async getProcessInfo() {
66
+ const { payload: { data } } = await this.wire.sendAction('get-process-info', this.identity);
67
+ return data;
68
+ }
69
+ async getSharedWorkers() {
70
+ return this.wire.sendAction('get-shared-workers', this.identity).then(({ payload }) => payload.data);
71
+ }
72
+ async inspectSharedWorker() {
73
+ await this.wire.sendAction('inspect-shared-worker', { ...this.identity });
74
+ }
75
+ async inspectSharedWorkerById(workerId) {
76
+ await this.wire.sendAction('inspect-shared-worker-by-id', { ...this.identity, workerId });
77
+ }
78
+ async inspectServiceWorker() {
79
+ await this.wire.sendAction('inspect-service-worker', { ...this.identity });
80
+ }
81
+ }
82
+ exports.WebContents = WebContents;
@@ -0,0 +1,44 @@
1
+ import { Base } from '../base';
2
+ /**
3
+ * @lends Window
4
+ */
5
+ export default class _WindowModule extends Base {
6
+ /**
7
+ * Asynchronously returns a Window object that represents an existing window.
8
+ * @param { Identity } identity
9
+ * @return {Promise.<_Window>}
10
+ * @tutorial Window.wrap
11
+ * @static
12
+ */
13
+ wrap(identity: OpenFin.Identity): Promise<OpenFin.Window>;
14
+ /**
15
+ * Synchronously returns a Window object that represents an existing window.
16
+ * @param { Identity } identity
17
+ * @return {_Window}
18
+ * @tutorial Window.wrapSync
19
+ * @static
20
+ */
21
+ wrapSync(identity: OpenFin.Identity): OpenFin.Window;
22
+ /**
23
+ * Creates a new Window.
24
+ * @param { Window~options } options - Window creation options
25
+ * @return {Promise.<_Window>}
26
+ * @tutorial Window.create
27
+ * @static
28
+ */
29
+ create(options: OpenFin.WindowCreationOptions): Promise<OpenFin.Window>;
30
+ /**
31
+ * Asynchronously returns a Window object that represents the current window
32
+ * @return {Promise.<_Window>}
33
+ * @tutorial Window.getCurrent
34
+ * @static
35
+ */
36
+ getCurrent(): Promise<OpenFin.Window>;
37
+ /**
38
+ * Synchronously returns a Window object that represents the current window
39
+ * @return {_Window}
40
+ * @tutorial Window.getCurrentSync
41
+ * @static
42
+ */
43
+ getCurrentSync(): OpenFin.Window;
44
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const base_1 = require("../base");
4
+ const validate_1 = require("../../util/validate");
5
+ const Instance_1 = require("./Instance");
6
+ /**
7
+ * @lends Window
8
+ */
9
+ class _WindowModule extends base_1.Base {
10
+ /**
11
+ * Asynchronously returns a Window object that represents an existing window.
12
+ * @param { Identity } identity
13
+ * @return {Promise.<_Window>}
14
+ * @tutorial Window.wrap
15
+ * @static
16
+ */
17
+ async wrap(identity) {
18
+ this.wire.sendAction('window-wrap').catch((e) => {
19
+ // we do not want to expose this error, just continue if this analytics-only call fails
20
+ });
21
+ const errorMsg = validate_1.validateIdentity(identity);
22
+ if (errorMsg) {
23
+ throw new Error(errorMsg);
24
+ }
25
+ return new Instance_1._Window(this.wire, identity);
26
+ }
27
+ /**
28
+ * Synchronously returns a Window object that represents an existing window.
29
+ * @param { Identity } identity
30
+ * @return {_Window}
31
+ * @tutorial Window.wrapSync
32
+ * @static
33
+ */
34
+ wrapSync(identity) {
35
+ this.wire.sendAction('window-wrap-sync').catch((e) => {
36
+ // we do not want to expose this error, just continue if this analytics-only call fails
37
+ });
38
+ const errorMsg = validate_1.validateIdentity(identity);
39
+ if (errorMsg) {
40
+ throw new Error(errorMsg);
41
+ }
42
+ return new Instance_1._Window(this.wire, identity);
43
+ }
44
+ /**
45
+ * Creates a new Window.
46
+ * @param { Window~options } options - Window creation options
47
+ * @return {Promise.<_Window>}
48
+ * @tutorial Window.create
49
+ * @static
50
+ */
51
+ create(options) {
52
+ this.wire.sendAction('create-window').catch((e) => {
53
+ // we do not want to expose this error, just continue if this analytics-only call fails
54
+ });
55
+ const win = new Instance_1._Window(this.wire, { uuid: this.me.uuid, name: options.name });
56
+ return win.createWindow(options);
57
+ }
58
+ /**
59
+ * Asynchronously returns a Window object that represents the current window
60
+ * @return {Promise.<_Window>}
61
+ * @tutorial Window.getCurrent
62
+ * @static
63
+ */
64
+ getCurrent() {
65
+ this.wire.sendAction('get-current-window').catch((e) => {
66
+ // we do not want to expose this error, just continue if this analytics-only call fails
67
+ });
68
+ if (!this.wire.me.isWindow) {
69
+ throw new Error('You are not in a Window context');
70
+ }
71
+ const { uuid, name } = this.wire.me;
72
+ return this.wrap({ uuid, name });
73
+ }
74
+ /**
75
+ * Synchronously returns a Window object that represents the current window
76
+ * @return {_Window}
77
+ * @tutorial Window.getCurrentSync
78
+ * @static
79
+ */
80
+ getCurrentSync() {
81
+ this.wire.sendAction('get-current-window-sync').catch((e) => {
82
+ // we do not want to expose this error, just continue if this analytics-only call fails
83
+ });
84
+ if (!this.wire.me.isWindow) {
85
+ throw new Error('You are not in a Window context');
86
+ }
87
+ const { uuid, name } = this.wire.me;
88
+ return this.wrapSync({ uuid, name });
89
+ }
90
+ }
91
+ exports.default = _WindowModule;