@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,69 @@
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 Frame
8
+ */
9
+ class _FrameModule extends base_1.Base {
10
+ /**
11
+ * Asynchronously returns a reference to the specified frame. The frame does not have to exist
12
+ * @param {Identity} identity - the identity of the frame you want to wrap
13
+ * @return {Promise.<_Frame>}
14
+ * @tutorial Frame.wrap
15
+ * @static
16
+ */
17
+ async wrap(identity) {
18
+ this.wire.sendAction('frame-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._Frame(this.wire, identity);
26
+ }
27
+ /**
28
+ * Synchronously returns a reference to the specified frame. The frame does not have to exist
29
+ * @param {Identity} identity - the identity of the frame you want to wrap
30
+ * @return {_Frame}
31
+ * @tutorial Frame.wrapSync
32
+ * @static
33
+ */
34
+ wrapSync(identity) {
35
+ this.wire.sendAction('frame-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._Frame(this.wire, identity);
43
+ }
44
+ /**
45
+ * Asynchronously returns a reference to the current frame
46
+ * @return {Promise.<_Frame>}
47
+ * @tutorial Frame.getCurrent
48
+ * @static
49
+ */
50
+ getCurrent() {
51
+ this.wire.sendAction('frame-get-current').catch((e) => {
52
+ // we do not want to expose this error, just continue if this analytics-only call fails
53
+ });
54
+ return Promise.resolve(new Instance_1._Frame(this.wire, this.wire.environment.getCurrentEntityIdentity()));
55
+ }
56
+ /**
57
+ * Synchronously returns a reference to the current frame
58
+ * @return {_Frame}
59
+ * @tutorial Frame.getCurrentSync
60
+ * @static
61
+ */
62
+ getCurrentSync() {
63
+ this.wire.sendAction('frame-get-current-sync').catch((e) => {
64
+ // we do not want to expose this error, just continue if this analytics-only call fails
65
+ });
66
+ return new Instance_1._Frame(this.wire, this.wire.environment.getCurrentEntityIdentity());
67
+ }
68
+ }
69
+ exports.default = _FrameModule;
@@ -0,0 +1,121 @@
1
+ import { EmitterBase } from '../base';
2
+ import Transport from '../../transport/transport';
3
+ import { FrameEvents } from '../events/frame';
4
+ /**
5
+ * @classdesc
6
+ * An iframe represents an embedded HTML page within a parent HTML page. Because this embedded page
7
+ * has its own DOM and global JS context (which may or may not be linked to that of the parent depending
8
+ * on if it is considered out of the root domain or not), it represents a unique endpoint as an OpenFin
9
+ * connection. Iframes may be generated dynamically, or be present on initial page load and each non-CORS
10
+ * iframe has the OpenFin API injected by default. It is possible to opt into cross-origin iframes having
11
+ * the API by setting api.iframe.crossOriginInjection to true in a window's options. To block all iframes
12
+ * from getting the API injected you can set api.frame.sameOriginInjection
13
+ * to false <a href="Window.html#~options" target="_blank">(see Window~options)</a>.
14
+ *
15
+ * To be able to directly address this context for eventing and messaging purposes, it needs a
16
+ * unique uuid name pairing. For OpenFin applications and windows this is provided via a configuration
17
+ * object in the form of a manifest URL or options object, but there is no configuration object for iframes.
18
+ * Just as a call to window.open outside of our Window API returns a new window with a random GUID assigned
19
+ * for the name, each iframe that has the API injected will be assigned a GUID as its name, the UUID will be
20
+ * the same as the parent window's.
21
+ *
22
+ * The fin.Frame namespace represents a way to interact with `iframes` and facilitates the discovery of current context
23
+ * (iframe or main window) as well as the ability to listen for <a href="tutorial-Frame.EventEmitter.html">frame-specific events</a>.
24
+ * @class
25
+ * @alias Frame
26
+ * @hideconstructor
27
+ */
28
+ export declare class _Frame extends EmitterBase<FrameEvents> {
29
+ identity: OpenFin.Identity;
30
+ constructor(wire: Transport, identity: OpenFin.Identity);
31
+ /**
32
+ * Adds the listener function to the end of the listeners array for the specified event type.
33
+ * @param { string | symbol } eventType - The type of the event.
34
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
35
+ * @param { SubOptions } [options] - Option to support event timestamps.
36
+ * @return {Promise.<this>}
37
+ * @function addListener
38
+ * @memberof Frame
39
+ * @instance
40
+ * @tutorial Frame.EventEmitter
41
+ */
42
+ /**
43
+ * Adds a listener to the end of the listeners array for the specified event.
44
+ * @param { string | symbol } eventType - The type of the event.
45
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
46
+ * @param { SubOptions } [options] - Option to support event timestamps.
47
+ * @return {Promise.<this>}
48
+ * @function on
49
+ * @memberof Frame
50
+ * @instance
51
+ * @tutorial Frame.EventEmitter
52
+ */
53
+ /**
54
+ * 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.
55
+ * @param { string | symbol } eventType - The type of the event.
56
+ * @param { Function } listener - The callback function.
57
+ * @param { SubOptions } [options] - Option to support event timestamps.
58
+ * @return {Promise.<this>}
59
+ * @function once
60
+ * @memberof Frame
61
+ * @instance
62
+ * @tutorial Frame.EventEmitter
63
+ */
64
+ /**
65
+ * Adds a listener to the beginning of the listeners array for the specified event.
66
+ * @param { string | symbol } eventType - The type of the event.
67
+ * @param { Function } listener - The callback function.
68
+ * @param { SubOptions } [options] - Option to support event timestamps.
69
+ * @return {Promise.<this>}
70
+ * @function prependListener
71
+ * @memberof Frame
72
+ * @instance
73
+ * @tutorial Frame.EventEmitter
74
+ */
75
+ /**
76
+ * 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.
77
+ * The listener is added to the beginning of the listeners array.
78
+ * @param { string | symbol } eventType - The type of the event.
79
+ * @param { Function } listener - The callback function.
80
+ * @param { SubOptions } [options] - Option to support event timestamps.
81
+ * @return {Promise.<this>}
82
+ * @function prependOnceListener
83
+ * @memberof Frame
84
+ * @instance
85
+ * @tutorial Frame.EventEmitter
86
+ */
87
+ /**
88
+ * Remove a listener from the listener array for the specified event.
89
+ * Caution: Calling this method changes the array indices in the listener array behind the listener.
90
+ * @param { string | symbol } eventType - The type of the event.
91
+ * @param { Function } listener - The callback function.
92
+ * @param { SubOptions } [options] - Option to support event timestamps.
93
+ * @return {Promise.<this>}
94
+ * @function removeListener
95
+ * @memberof Frame
96
+ * @instance
97
+ * @tutorial Frame.EventEmitter
98
+ */
99
+ /**
100
+ * Removes all listeners, or those of the specified event.
101
+ * @param { string | symbol } [eventType] - The type of the event.
102
+ * @return {Promise.<this>}
103
+ * @function removeAllListeners
104
+ * @memberof Frame
105
+ * @instance
106
+ * @tutorial Frame.EventEmitter
107
+ */
108
+ /**
109
+ * Returns a frame info object for the represented frame
110
+ * @return {Promise.<FrameInfo>}
111
+ * @tutorial Frame.getInfo
112
+ */
113
+ getInfo(): Promise<OpenFin.FrameInfo>;
114
+ /**
115
+ * Returns a frame info object representing the window that the referenced iframe is
116
+ * currently embedded in
117
+ * @return {Promise.<FrameInfo>}
118
+ * @tutorial Frame.getParentWindow
119
+ */
120
+ getParentWindow(): Promise<OpenFin.FrameInfo>;
121
+ }
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._Frame = void 0;
4
+ /* eslint-disable import/prefer-default-export */
5
+ const base_1 = require("../base");
6
+ /**
7
+ * @classdesc
8
+ * An iframe represents an embedded HTML page within a parent HTML page. Because this embedded page
9
+ * has its own DOM and global JS context (which may or may not be linked to that of the parent depending
10
+ * on if it is considered out of the root domain or not), it represents a unique endpoint as an OpenFin
11
+ * connection. Iframes may be generated dynamically, or be present on initial page load and each non-CORS
12
+ * iframe has the OpenFin API injected by default. It is possible to opt into cross-origin iframes having
13
+ * the API by setting api.iframe.crossOriginInjection to true in a window's options. To block all iframes
14
+ * from getting the API injected you can set api.frame.sameOriginInjection
15
+ * to false <a href="Window.html#~options" target="_blank">(see Window~options)</a>.
16
+ *
17
+ * To be able to directly address this context for eventing and messaging purposes, it needs a
18
+ * unique uuid name pairing. For OpenFin applications and windows this is provided via a configuration
19
+ * object in the form of a manifest URL or options object, but there is no configuration object for iframes.
20
+ * Just as a call to window.open outside of our Window API returns a new window with a random GUID assigned
21
+ * for the name, each iframe that has the API injected will be assigned a GUID as its name, the UUID will be
22
+ * the same as the parent window's.
23
+ *
24
+ * The fin.Frame namespace represents a way to interact with `iframes` and facilitates the discovery of current context
25
+ * (iframe or main window) as well as the ability to listen for <a href="tutorial-Frame.EventEmitter.html">frame-specific events</a>.
26
+ * @class
27
+ * @alias Frame
28
+ * @hideconstructor
29
+ */
30
+ class _Frame extends base_1.EmitterBase {
31
+ constructor(wire, identity) {
32
+ super(wire, 'frame', identity.uuid, identity.name);
33
+ this.identity = identity;
34
+ }
35
+ /**
36
+ * Adds the listener function to the end of the listeners array for the specified event type.
37
+ * @param { string | symbol } eventType - The type of the event.
38
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
39
+ * @param { SubOptions } [options] - Option to support event timestamps.
40
+ * @return {Promise.<this>}
41
+ * @function addListener
42
+ * @memberof Frame
43
+ * @instance
44
+ * @tutorial Frame.EventEmitter
45
+ */
46
+ /**
47
+ * Adds a listener to the end of the listeners array for the specified event.
48
+ * @param { string | symbol } eventType - The type of the event.
49
+ * @param { Function } listener - Called whenever an event of the specified type occurs.
50
+ * @param { SubOptions } [options] - Option to support event timestamps.
51
+ * @return {Promise.<this>}
52
+ * @function on
53
+ * @memberof Frame
54
+ * @instance
55
+ * @tutorial Frame.EventEmitter
56
+ */
57
+ /**
58
+ * 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.
59
+ * @param { string | symbol } eventType - The type of the event.
60
+ * @param { Function } listener - The callback function.
61
+ * @param { SubOptions } [options] - Option to support event timestamps.
62
+ * @return {Promise.<this>}
63
+ * @function once
64
+ * @memberof Frame
65
+ * @instance
66
+ * @tutorial Frame.EventEmitter
67
+ */
68
+ /**
69
+ * Adds a listener to the beginning of the listeners array for the specified event.
70
+ * @param { string | symbol } eventType - The type of the event.
71
+ * @param { Function } listener - The callback function.
72
+ * @param { SubOptions } [options] - Option to support event timestamps.
73
+ * @return {Promise.<this>}
74
+ * @function prependListener
75
+ * @memberof Frame
76
+ * @instance
77
+ * @tutorial Frame.EventEmitter
78
+ */
79
+ /**
80
+ * 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.
81
+ * The listener is added to the beginning of the listeners array.
82
+ * @param { string | symbol } eventType - The type of the event.
83
+ * @param { Function } listener - The callback function.
84
+ * @param { SubOptions } [options] - Option to support event timestamps.
85
+ * @return {Promise.<this>}
86
+ * @function prependOnceListener
87
+ * @memberof Frame
88
+ * @instance
89
+ * @tutorial Frame.EventEmitter
90
+ */
91
+ /**
92
+ * Remove a listener from the listener array for the specified event.
93
+ * Caution: Calling this method changes the array indices in the listener array behind the listener.
94
+ * @param { string | symbol } eventType - The type of the event.
95
+ * @param { Function } listener - The callback function.
96
+ * @param { SubOptions } [options] - Option to support event timestamps.
97
+ * @return {Promise.<this>}
98
+ * @function removeListener
99
+ * @memberof Frame
100
+ * @instance
101
+ * @tutorial Frame.EventEmitter
102
+ */
103
+ /**
104
+ * Removes all listeners, or those of the specified event.
105
+ * @param { string | symbol } [eventType] - The type of the event.
106
+ * @return {Promise.<this>}
107
+ * @function removeAllListeners
108
+ * @memberof Frame
109
+ * @instance
110
+ * @tutorial Frame.EventEmitter
111
+ */
112
+ /**
113
+ * Returns a frame info object for the represented frame
114
+ * @return {Promise.<FrameInfo>}
115
+ * @tutorial Frame.getInfo
116
+ */
117
+ getInfo() {
118
+ return this.wire.sendAction('get-frame-info', this.identity).then(({ payload }) => payload.data);
119
+ }
120
+ /**
121
+ * Returns a frame info object representing the window that the referenced iframe is
122
+ * currently embedded in
123
+ * @return {Promise.<FrameInfo>}
124
+ * @tutorial Frame.getParentWindow
125
+ */
126
+ getParentWindow() {
127
+ return this.wire.sendAction('get-parent-window', this.identity).then(({ payload }) => payload.data);
128
+ }
129
+ }
130
+ exports._Frame = _Frame;
@@ -0,0 +1,3 @@
1
+ import _FrameModule from './Factory';
2
+ export default _FrameModule;
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,38 @@
1
+ import { EmitterBase } from '../base';
2
+ import Transport from '../../transport/transport';
3
+ import { GlobalHotkeyEvents } from '../events/globalHotkey';
4
+ /**
5
+ * The GlobalHotkey module can register/unregister a global hotkeys.
6
+ * @namespace
7
+ */
8
+ export default class GlobalHotkey extends EmitterBase<GlobalHotkeyEvents> {
9
+ constructor(wire: Transport);
10
+ /**
11
+ * Registers a global hotkey with the operating system.
12
+ * @param { string } hotkey a hotkey string
13
+ * @param { Function } listener called when the registered hotkey is pressed by the user.
14
+ * @return {Promise.<void>}
15
+ * @tutorial GlobalHotkey.register
16
+ */
17
+ register(hotkey: string, listener: (...args: any[]) => void): Promise<void>;
18
+ /**
19
+ * Unregisters a global hotkey with the operating system.
20
+ * @param { string } hotkey a hotkey string
21
+ * @return {Promise.<void>}
22
+ * @tutorial GlobalHotkey.unregister
23
+ */
24
+ unregister(hotkey: string): Promise<void>;
25
+ /**
26
+ * Unregisters all global hotkeys for the current application.
27
+ * @return {Promise.<void>}
28
+ * @tutorial GlobalHotkey.unregisterAll
29
+ */
30
+ unregisterAll(): Promise<void>;
31
+ /**
32
+ * Checks if a given hotkey has been registered
33
+ * @param { string } hotkey a hotkey string
34
+ * @return {Promise.<boolean>}
35
+ * @tutorial GlobalHotkey.isRegistered
36
+ */
37
+ isRegistered(hotkey: string): Promise<boolean>;
38
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const base_1 = require("../base");
4
+ /**
5
+ * The GlobalHotkey module can register/unregister a global hotkeys.
6
+ * @namespace
7
+ */
8
+ class GlobalHotkey extends base_1.EmitterBase {
9
+ constructor(wire) {
10
+ super(wire, 'global-hotkey');
11
+ }
12
+ /**
13
+ * Registers a global hotkey with the operating system.
14
+ * @param { string } hotkey a hotkey string
15
+ * @param { Function } listener called when the registered hotkey is pressed by the user.
16
+ * @return {Promise.<void>}
17
+ * @tutorial GlobalHotkey.register
18
+ */
19
+ async register(hotkey, listener) {
20
+ await this.on(hotkey, listener);
21
+ await this.wire.sendAction('global-hotkey-register', { hotkey });
22
+ return undefined;
23
+ }
24
+ /**
25
+ * Unregisters a global hotkey with the operating system.
26
+ * @param { string } hotkey a hotkey string
27
+ * @return {Promise.<void>}
28
+ * @tutorial GlobalHotkey.unregister
29
+ */
30
+ async unregister(hotkey) {
31
+ await this.removeAllListeners(hotkey);
32
+ await this.wire.sendAction('global-hotkey-unregister', { hotkey });
33
+ return undefined;
34
+ }
35
+ /**
36
+ * Unregisters all global hotkeys for the current application.
37
+ * @return {Promise.<void>}
38
+ * @tutorial GlobalHotkey.unregisterAll
39
+ */
40
+ async unregisterAll() {
41
+ await Promise.all(this.eventNames()
42
+ .filter((name) => !(name === 'registered' || name === 'unregistered'))
43
+ .map((name) => this.removeAllListeners(name)));
44
+ await this.wire.sendAction('global-hotkey-unregister-all', {});
45
+ return undefined;
46
+ }
47
+ /**
48
+ * Checks if a given hotkey has been registered
49
+ * @param { string } hotkey a hotkey string
50
+ * @return {Promise.<boolean>}
51
+ * @tutorial GlobalHotkey.isRegistered
52
+ */
53
+ async isRegistered(hotkey) {
54
+ const { payload: { data } } = await this.wire.sendAction('global-hotkey-is-registered', { hotkey });
55
+ return data;
56
+ }
57
+ }
58
+ exports.default = GlobalHotkey;
@@ -0,0 +1,26 @@
1
+ import Transport from '../../../transport/transport';
2
+ import ProviderIdentity = OpenFin.ProviderIdentity;
3
+ export declare type ChannelAction = (payload: unknown, id: ProviderIdentity | OpenFin.ClientIdentity) => unknown;
4
+ export declare type ChannelMiddleware = (topic: string, payload: unknown, senderIdentity: ProviderIdentity | OpenFin.ClientIdentity) => unknown;
5
+ export declare type ErrorMiddleware = (topic: string, error: Error, id: ProviderIdentity | OpenFin.ClientIdentity) => unknown;
6
+ export declare class ProtectedItems {
7
+ providerIdentity: ProviderIdentity;
8
+ wire: Transport;
9
+ constructor(providerIdentity: ProviderIdentity, wire: Transport);
10
+ }
11
+ export declare class ChannelBase {
12
+ protected subscriptions: Map<string, ChannelAction>;
13
+ private defaultAction?;
14
+ private preAction?;
15
+ private postAction?;
16
+ private errorMiddleware?;
17
+ private static defaultAction;
18
+ constructor();
19
+ protected processAction(topic: string, payload: unknown, senderIdentity: ProviderIdentity | OpenFin.ClientIdentity): Promise<unknown>;
20
+ beforeAction(func: ChannelMiddleware): void;
21
+ onError(func: ErrorMiddleware): void;
22
+ afterAction(func: ChannelMiddleware): void;
23
+ remove(action: string): void;
24
+ setDefaultAction(func: ChannelMiddleware): void;
25
+ register(topic: string, listener: ChannelAction): boolean;
26
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChannelBase = exports.ProtectedItems = void 0;
4
+ const resultOrPayload = (func) => (topic, payload, senderIdentity) => {
5
+ const res = func(topic, payload, senderIdentity);
6
+ return res === undefined ? payload : res;
7
+ };
8
+ class ProtectedItems {
9
+ constructor(providerIdentity, wire) {
10
+ this.providerIdentity = providerIdentity;
11
+ this.wire = wire;
12
+ }
13
+ }
14
+ exports.ProtectedItems = ProtectedItems;
15
+ class ChannelBase {
16
+ constructor() {
17
+ this.subscriptions = new Map();
18
+ }
19
+ static defaultAction(topic) {
20
+ throw new Error(`No action registered at target for ${topic}`);
21
+ }
22
+ async processAction(topic, payload, senderIdentity) {
23
+ try {
24
+ const mainAction = this.subscriptions.has(topic)
25
+ ? this.subscriptions.get(topic)
26
+ : (currentPayload, id) => { var _a; return ((_a = this.defaultAction) !== null && _a !== void 0 ? _a : ChannelBase.defaultAction)(topic, currentPayload, id); };
27
+ const preActionProcessed = this.preAction ? await this.preAction(topic, payload, senderIdentity) : payload;
28
+ const actionProcessed = await mainAction(preActionProcessed, senderIdentity);
29
+ return this.postAction ? await this.postAction(topic, actionProcessed, senderIdentity) : actionProcessed;
30
+ }
31
+ catch (e) {
32
+ if (this.errorMiddleware) {
33
+ return this.errorMiddleware(topic, e, senderIdentity);
34
+ }
35
+ throw e;
36
+ }
37
+ }
38
+ beforeAction(func) {
39
+ if (this.preAction) {
40
+ throw new Error('Already registered beforeAction middleware');
41
+ }
42
+ this.preAction = resultOrPayload(func);
43
+ }
44
+ onError(func) {
45
+ if (this.errorMiddleware) {
46
+ throw new Error('Already registered error middleware');
47
+ }
48
+ this.errorMiddleware = func;
49
+ }
50
+ afterAction(func) {
51
+ if (this.postAction) {
52
+ throw new Error('Already registered afterAction middleware');
53
+ }
54
+ this.postAction = resultOrPayload(func);
55
+ }
56
+ remove(action) {
57
+ this.subscriptions.delete(action);
58
+ }
59
+ setDefaultAction(func) {
60
+ if (this.defaultAction) {
61
+ throw new Error('default action can only be set once');
62
+ }
63
+ else {
64
+ this.defaultAction = func;
65
+ }
66
+ }
67
+ register(topic, listener) {
68
+ if (this.subscriptions.has(topic)) {
69
+ throw new Error(`Subscription already registered for action: ${topic}. Unsubscribe before adding new subscription`);
70
+ }
71
+ else {
72
+ this.subscriptions.set(topic, listener);
73
+ return true;
74
+ }
75
+ }
76
+ }
77
+ exports.ChannelBase = ChannelBase;