@openfin/core 33.76.36 → 33.76.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/OpenFin.d.ts +1 -1
  2. package/README.md +29 -4
  3. package/fin.d.ts +2 -2
  4. package/{src → out}/GlobalOpenFin.d.ts +1 -1
  5. package/out/mock-alpha.d.ts +16112 -0
  6. package/out/mock-beta.d.ts +16112 -0
  7. package/out/mock-public.d.ts +16112 -0
  8. package/out/mock.d.ts +16797 -0
  9. package/out/mock.js +17104 -0
  10. package/package.json +30 -23
  11. package/LICENSE +0 -13
  12. package/NOTICE +0 -16
  13. package/openfin-core-33.76.36.tgz +0 -0
  14. package/src/OpenFin.d.ts +0 -3091
  15. package/src/OpenFin.js +0 -2
  16. package/src/api/api-exposer/api-consumer.d.ts +0 -28
  17. package/src/api/api-exposer/api-consumer.js +0 -28
  18. package/src/api/api-exposer/api-exposer.d.ts +0 -35
  19. package/src/api/api-exposer/api-exposer.js +0 -38
  20. package/src/api/api-exposer/decorators.d.ts +0 -10
  21. package/src/api/api-exposer/decorators.js +0 -18
  22. package/src/api/api-exposer/index.d.ts +0 -4
  23. package/src/api/api-exposer/index.js +0 -20
  24. package/src/api/api-exposer/strategies/index.d.ts +0 -1
  25. package/src/api/api-exposer/strategies/index.js +0 -17
  26. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
  27. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
  28. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
  29. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
  30. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
  31. package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
  32. package/src/api/application/Factory.d.ts +0 -196
  33. package/src/api/application/Factory.js +0 -278
  34. package/src/api/application/Instance.d.ts +0 -692
  35. package/src/api/application/Instance.js +0 -821
  36. package/src/api/application/index.d.ts +0 -12
  37. package/src/api/application/index.js +0 -28
  38. package/src/api/base.d.ts +0 -117
  39. package/src/api/base.js +0 -246
  40. package/src/api/clipboard/index.d.ts +0 -172
  41. package/src/api/clipboard/index.js +0 -200
  42. package/src/api/events/application.d.ts +0 -158
  43. package/src/api/events/application.js +0 -14
  44. package/src/api/events/base.d.ts +0 -42
  45. package/src/api/events/base.js +0 -2
  46. package/src/api/events/channel.d.ts +0 -35
  47. package/src/api/events/channel.js +0 -7
  48. package/src/api/events/emitterMap.d.ts +0 -11
  49. package/src/api/events/emitterMap.js +0 -35
  50. package/src/api/events/eventAggregator.d.ts +0 -5
  51. package/src/api/events/eventAggregator.js +0 -35
  52. package/src/api/events/externalApplication.d.ts +0 -24
  53. package/src/api/events/externalApplication.js +0 -7
  54. package/src/api/events/frame.d.ts +0 -35
  55. package/src/api/events/frame.js +0 -2
  56. package/src/api/events/globalHotkey.d.ts +0 -25
  57. package/src/api/events/globalHotkey.js +0 -2
  58. package/src/api/events/platform.d.ts +0 -34
  59. package/src/api/events/platform.js +0 -10
  60. package/src/api/events/system.d.ts +0 -126
  61. package/src/api/events/system.js +0 -15
  62. package/src/api/events/typedEventEmitter.d.ts +0 -20
  63. package/src/api/events/typedEventEmitter.js +0 -2
  64. package/src/api/events/view.d.ts +0 -92
  65. package/src/api/events/view.js +0 -12
  66. package/src/api/events/webcontents.d.ts +0 -277
  67. package/src/api/events/webcontents.js +0 -13
  68. package/src/api/events/window.d.ts +0 -421
  69. package/src/api/events/window.js +0 -12
  70. package/src/api/external-application/Factory.d.ts +0 -34
  71. package/src/api/external-application/Factory.js +0 -47
  72. package/src/api/external-application/Instance.d.ts +0 -110
  73. package/src/api/external-application/Instance.js +0 -117
  74. package/src/api/external-application/index.d.ts +0 -12
  75. package/src/api/external-application/index.js +0 -28
  76. package/src/api/fin.d.ts +0 -54
  77. package/src/api/fin.js +0 -45
  78. package/src/api/frame/Factory.d.ts +0 -54
  79. package/src/api/frame/Factory.js +0 -86
  80. package/src/api/frame/Instance.d.ts +0 -136
  81. package/src/api/frame/Instance.js +0 -143
  82. package/src/api/frame/index.d.ts +0 -14
  83. package/src/api/frame/index.js +0 -30
  84. package/src/api/global-hotkey/index.d.ts +0 -106
  85. package/src/api/global-hotkey/index.js +0 -132
  86. package/src/api/interappbus/channel/channel.d.ts +0 -285
  87. package/src/api/interappbus/channel/channel.js +0 -334
  88. package/src/api/interappbus/channel/channels-docs.d.ts +0 -342
  89. package/src/api/interappbus/channel/channels-docs.js +0 -401
  90. package/src/api/interappbus/channel/client.d.ts +0 -117
  91. package/src/api/interappbus/channel/client.js +0 -181
  92. package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
  93. package/src/api/interappbus/channel/connection-manager.js +0 -246
  94. package/src/api/interappbus/channel/index.d.ts +0 -189
  95. package/src/api/interappbus/channel/index.js +0 -333
  96. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
  97. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
  98. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
  99. package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
  100. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
  101. package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
  102. package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
  103. package/src/api/interappbus/channel/protocols/index.js +0 -2
  104. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
  105. package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
  106. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
  107. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
  108. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
  109. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
  110. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
  111. package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
  112. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
  113. package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
  114. package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
  115. package/src/api/interappbus/channel/protocols/strategy.js +0 -2
  116. package/src/api/interappbus/channel/provider.d.ts +0 -206
  117. package/src/api/interappbus/channel/provider.js +0 -338
  118. package/src/api/interappbus/index.d.ts +0 -120
  119. package/src/api/interappbus/index.js +0 -210
  120. package/src/api/interop/Factory.d.ts +0 -57
  121. package/src/api/interop/Factory.js +0 -96
  122. package/src/api/interop/InteropBroker.d.ts +0 -665
  123. package/src/api/interop/InteropBroker.js +0 -1313
  124. package/src/api/interop/InteropClient.d.ts +0 -502
  125. package/src/api/interop/InteropClient.js +0 -683
  126. package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
  127. package/src/api/interop/SessionContextGroupBroker.js +0 -108
  128. package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
  129. package/src/api/interop/SessionContextGroupClient.js +0 -86
  130. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
  131. package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
  132. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
  133. package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
  134. package/src/api/interop/fdc3/documentationStub.d.ts +0 -14
  135. package/src/api/interop/fdc3/documentationStub.js +0 -17
  136. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -205
  137. package/src/api/interop/fdc3/fdc3-1.2.js +0 -435
  138. package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -298
  139. package/src/api/interop/fdc3/fdc3-2.0.js +0 -479
  140. package/src/api/interop/fdc3/fdc3.d.ts +0 -12
  141. package/src/api/interop/fdc3/fdc3.js +0 -35
  142. package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
  143. package/src/api/interop/fdc3/overrideCheck.js +0 -32
  144. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
  145. package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
  146. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
  147. package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
  148. package/src/api/interop/fdc3/utils.d.ts +0 -45
  149. package/src/api/interop/fdc3/utils.js +0 -239
  150. package/src/api/interop/fdc3/versions.d.ts +0 -1
  151. package/src/api/interop/fdc3/versions.js +0 -2
  152. package/src/api/interop/index.d.ts +0 -12
  153. package/src/api/interop/index.js +0 -28
  154. package/src/api/interop/utils.d.ts +0 -18
  155. package/src/api/interop/utils.js +0 -61
  156. package/src/api/me.d.ts +0 -40
  157. package/src/api/me.js +0 -134
  158. package/src/api/platform/Factory.d.ts +0 -171
  159. package/src/api/platform/Factory.js +0 -240
  160. package/src/api/platform/Instance.d.ts +0 -653
  161. package/src/api/platform/Instance.js +0 -834
  162. package/src/api/platform/common-utils.d.ts +0 -7
  163. package/src/api/platform/common-utils.js +0 -16
  164. package/src/api/platform/index.d.ts +0 -12
  165. package/src/api/platform/index.js +0 -28
  166. package/src/api/platform/layout/Factory.d.ts +0 -91
  167. package/src/api/platform/layout/Factory.js +0 -151
  168. package/src/api/platform/layout/Instance.d.ts +0 -192
  169. package/src/api/platform/layout/Instance.js +0 -224
  170. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
  171. package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
  172. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
  173. package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
  174. package/src/api/platform/layout/entities/layout-entities.d.ts +0 -427
  175. package/src/api/platform/layout/entities/layout-entities.js +0 -504
  176. package/src/api/platform/layout/entities/shapes.d.ts +0 -6
  177. package/src/api/platform/layout/entities/shapes.js +0 -2
  178. package/src/api/platform/layout/index.d.ts +0 -11
  179. package/src/api/platform/layout/index.js +0 -27
  180. package/src/api/platform/layout/layout.constants.d.ts +0 -1
  181. package/src/api/platform/layout/layout.constants.js +0 -4
  182. package/src/api/platform/layout/shapes.d.ts +0 -16
  183. package/src/api/platform/layout/shapes.js +0 -2
  184. package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
  185. package/src/api/platform/layout/utils/layout-traversal.js +0 -65
  186. package/src/api/platform/provider.d.ts +0 -510
  187. package/src/api/platform/provider.js +0 -2
  188. package/src/api/snapshot-source/Factory.d.ts +0 -53
  189. package/src/api/snapshot-source/Factory.js +0 -81
  190. package/src/api/snapshot-source/Instance.d.ts +0 -53
  191. package/src/api/snapshot-source/Instance.js +0 -154
  192. package/src/api/snapshot-source/index.d.ts +0 -12
  193. package/src/api/snapshot-source/index.js +0 -28
  194. package/src/api/snapshot-source/utils.d.ts +0 -2
  195. package/src/api/snapshot-source/utils.js +0 -6
  196. package/src/api/system/index.d.ts +0 -1468
  197. package/src/api/system/index.js +0 -1851
  198. package/src/api/view/Factory.d.ts +0 -88
  199. package/src/api/view/Factory.js +0 -141
  200. package/src/api/view/Instance.d.ts +0 -601
  201. package/src/api/view/Instance.js +0 -671
  202. package/src/api/view/index.d.ts +0 -12
  203. package/src/api/view/index.js +0 -28
  204. package/src/api/webcontents/main.d.ts +0 -922
  205. package/src/api/webcontents/main.js +0 -1046
  206. package/src/api/window/Factory.d.ts +0 -96
  207. package/src/api/window/Factory.js +0 -142
  208. package/src/api/window/Instance.d.ts +0 -1598
  209. package/src/api/window/Instance.js +0 -1851
  210. package/src/api/window/index.d.ts +0 -14
  211. package/src/api/window/index.js +0 -30
  212. package/src/browser.d.ts +0 -10
  213. package/src/browser.js +0 -36
  214. package/src/environment/browser.d.ts +0 -29
  215. package/src/environment/browser.js +0 -60
  216. package/src/environment/environment.d.ts +0 -33
  217. package/src/environment/environment.js +0 -4
  218. package/src/environment/mockEnvironment.d.ts +0 -27
  219. package/src/environment/mockEnvironment.js +0 -61
  220. package/src/environment/node-env.d.ts +0 -29
  221. package/src/environment/node-env.js +0 -72
  222. package/src/fdc3.d.ts +0 -3
  223. package/src/fdc3.js +0 -9
  224. package/src/mock.d.ts +0 -3
  225. package/src/mock.js +0 -18
  226. package/src/namespaces.d.ts +0 -22
  227. package/src/namespaces.js +0 -26
  228. package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
  229. package/src/shapes/ERROR_BOX_TYPES.js +0 -2
  230. package/src/shapes/WebOptions.d.ts +0 -13
  231. package/src/shapes/WebOptions.js +0 -2
  232. package/src/shapes/WindowOptions.d.ts +0 -43
  233. package/src/shapes/WindowOptions.js +0 -2
  234. package/src/shapes/protocol.d.ts +0 -204
  235. package/src/shapes/protocol.js +0 -2
  236. package/src/transport/mockWire.d.ts +0 -11
  237. package/src/transport/mockWire.js +0 -26
  238. package/src/transport/transport-errors.d.ts +0 -31
  239. package/src/transport/transport-errors.js +0 -79
  240. package/src/transport/transport.d.ts +0 -73
  241. package/src/transport/transport.js +0 -219
  242. package/src/transport/wire.d.ts +0 -77
  243. package/src/transport/wire.js +0 -36
  244. package/src/util/asyncFilter.d.ts +0 -1
  245. package/src/util/asyncFilter.js +0 -7
  246. package/src/util/channel-api-relay.d.ts +0 -13
  247. package/src/util/channel-api-relay.js +0 -47
  248. package/src/util/errors.d.ts +0 -10
  249. package/src/util/errors.js +0 -12
  250. package/src/util/exhaustive.d.ts +0 -1
  251. package/src/util/exhaustive.js +0 -7
  252. package/src/util/http.d.ts +0 -11
  253. package/src/util/http.js +0 -90
  254. package/src/util/inaccessibleObject.d.ts +0 -2
  255. package/src/util/inaccessibleObject.js +0 -49
  256. package/src/util/lazy.d.ts +0 -34
  257. package/src/util/lazy.js +0 -54
  258. package/src/util/normalize-config.d.ts +0 -3
  259. package/src/util/normalize-config.js +0 -52
  260. package/src/util/promises.d.ts +0 -5
  261. package/src/util/promises.js +0 -27
  262. package/src/util/ref-counter.d.ts +0 -7
  263. package/src/util/ref-counter.js +0 -52
  264. package/src/util/reversible-map.d.ts +0 -11
  265. package/src/util/reversible-map.js +0 -49
  266. package/src/util/runtimeVersioning.d.ts +0 -3
  267. package/src/util/runtimeVersioning.js +0 -25
  268. package/src/util/utilTypes.d.ts +0 -8
  269. package/src/util/utilTypes.js +0 -2
  270. package/src/util/validate.d.ts +0 -3
  271. package/src/util/validate.js +0 -11
@@ -1,171 +0,0 @@
1
- import type * as OpenFin from '../../OpenFin';
2
- import { Transport } from '../../transport/transport';
3
- import { Base } from '../base';
4
- import { LayoutModule } from './layout/index';
5
- type Channel = OpenFin.Fin['InterApplicationBus']['Channel'];
6
- export default class PlatformModule extends Base {
7
- private _channel;
8
- Layout: LayoutModule;
9
- /**
10
- * @internal
11
- */
12
- constructor(wire: Transport, channel: Channel);
13
- /**
14
- * Initializes a Platform. Must be called from the Provider when using a custom provider.
15
- * @param options - platform options including a callback function that can be used to extend or replace
16
- * default Provider behavior.
17
- *
18
- * @remarks Must be called from the Provider when using a custom provider.
19
- *
20
- * @example
21
- *
22
- * ```js
23
- * // From Provider context
24
- * await fin.Platform.init();
25
- * // Platform API is now hooked up and windows contained in the manifest snapshot are open.
26
- * ```
27
- *
28
- * `Platform.init` accepts an options object that can contain a callback function which can be used to extend or
29
- * replace default Provider behavior. As an argument, this function will receive the `Provider` class, which is
30
- * used to handle Platform actions. The function must return an object with methods to handle Platform API actions.
31
- * The recommended approach is to extend the `Provider` class, overriding the methods you wish to alter, and return an
32
- * instance of your subclass:
33
- *
34
- * ```js
35
- * const overrideCallback = async (PlatformProvider) => {
36
- * // Actions can be performed before initialization.
37
- * // e.g. we might authenticate a user, set up a Channel, etc before initializing the Platform.
38
- * const { manifestUrl } = await fin.Application.getCurrentSync().getInfo();
39
- *
40
- * // Extend or replace default PlatformProvider behavior by extending the PlatformProvider class.
41
- * class MyOverride extends PlatformProvider {
42
- * // Default behavior can be changed by implementing methods with the same names as those used by the default PlatformProvider.
43
- * async getSnapshot() {
44
- * // Since we are extending the class, we can call `super` methods to access default behavior.
45
- * const snapshot = await super.getSnapshot();
46
- * // But we can modify return values.
47
- * return { ...snapshot, answer: 42, manifestUrl };
48
- * }
49
- * async replaceLayout({ opts, target }) {
50
- * // To disable an API method, overwrite with a noop function.
51
- * return;
52
- * }
53
- * }
54
- * // Return instance with methods to be consumed by Platform.
55
- * // The returned object must implement all methods of the PlatformProvider class.
56
- * // By extending the class, we can simply inherit methods we do not wish to alter.
57
- * return new MyOverride();
58
- * };
59
- *
60
- * fin.Platform.init({overrideCallback});
61
- * ```
62
- * @experimental
63
- * @static
64
- */
65
- init(options?: OpenFin.InitPlatformOptions): Promise<void>;
66
- /**
67
- * Asynchronously returns a Platform object that represents an existing platform.
68
- * @param identity
69
- *
70
- * @example
71
- * ```js
72
- * const { identity } = fin.me;
73
- * const platform = await fin.Platform.wrap(identity);
74
- * // Use wrapped instance to control layout, e.g.:
75
- * const snapshot = await platform.getSnapshot();
76
- * ```
77
- * @static
78
- */
79
- wrap(identity: OpenFin.ApplicationIdentity): Promise<OpenFin.Platform>;
80
- /**
81
- * Synchronously returns a Platform object that represents an existing platform.
82
- * @param identity
83
- *
84
- * @example
85
- * ```js
86
- * const { identity } = fin.me;
87
- * const platform = fin.Platform.wrapSync(identity);
88
- * // Use wrapped instance to control layout, e.g.:
89
- * const snapshot = await platform.getSnapshot();
90
- * ```
91
- * @static
92
- */
93
- wrapSync(identity: OpenFin.ApplicationIdentity): OpenFin.Platform;
94
- /**
95
- * Asynchronously returns a Platform object that represents the current platform.
96
- *
97
- * @example
98
- * ```js
99
- * const platform = await fin.Platform.getCurrent();
100
- * // Use wrapped instance to control layout, e.g.:
101
- * const snapshot = await platform.getSnapshot();
102
- * ```
103
- * @static
104
- */
105
- getCurrent(): Promise<OpenFin.Platform>;
106
- /**
107
- * Synchronously returns a Platform object that represents the current platform.
108
- *
109
- * @example
110
- * ```js
111
- * const platform = fin.Platform.getCurrentSync();
112
- * // Use wrapped instance to control layout, e.g.:
113
- * const snapshot = await platform.getSnapshot();
114
- * ```
115
- * @static
116
- */
117
- getCurrentSync(): OpenFin.Platform;
118
- /**
119
- * Creates and starts a Platform and returns a wrapped and running Platform instance. The wrapped Platform methods can
120
- * be used to launch content into the platform. Promise will reject if the platform is already running.
121
- * @param platformOptions
122
- *
123
- * @example
124
- * ```js
125
- * try {
126
- * const platform = await fin.Platform.start({
127
- * uuid: 'platform-1',
128
- * autoShow: false,
129
- * defaultWindowOptions: {
130
- * stylesheetUrl: 'css-sheet-url',
131
- * cornerRounding: {
132
- * height: 10,
133
- * width: 10
134
- * }
135
- * }
136
- * });
137
- * console.log('Platform is running', platform);
138
- * } catch(e) {
139
- * console.error(e);
140
- * }
141
- * ```
142
- * @static
143
- */
144
- start(platformOptions: OpenFin.PlatformOptions): Promise<OpenFin.Platform>;
145
- /**
146
- * Retrieves platforms's manifest and returns a wrapped and running Platform. If there is a snapshot in the manifest,
147
- * it will be launched into the platform.
148
- * @param manifestUrl - The URL of platform's manifest.
149
- * @param opts - Parameters that the RVM will use.
150
- *
151
- * @example
152
- * ```js
153
- * try {
154
- * const platform = await fin.Platform.startFromManifest('https://openfin.github.io/golden-prototype/public.json');
155
- * console.log('Platform is running, wrapped platform: ', platform);
156
- * } catch(e) {
157
- * console.error(e);
158
- * }
159
- * // For a local manifest file:
160
- * try {
161
- * const platform = await fin.Platform.startFromManifest('file:///C:/somefolder/app.json');
162
- * console.log('Platform is running, wrapped platform: ', platform);
163
- * } catch(e) {
164
- * console.error(e);
165
- * }
166
- * ```
167
- * @static
168
- */
169
- startFromManifest(manifestUrl: string, opts?: OpenFin.RvmLaunchOptions): Promise<OpenFin.Platform>;
170
- }
171
- export {};
@@ -1,240 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const base_1 = require("../base");
4
- const Instance_1 = require("./Instance");
5
- const index_1 = require("./layout/index");
6
- class PlatformModule extends base_1.Base {
7
- /**
8
- * @internal
9
- */
10
- constructor(wire, channel) {
11
- super(wire);
12
- this._channel = channel;
13
- /**
14
- *
15
- * @desc Layouts give app providers the ability to embed multiple views in a single window. The Layout namespace
16
- * enables the initialization and manipulation of a window's Layout. A Layout will
17
- * <a href="tutorial-Layout.DOMEvents.html">emit events locally</a> on the DOM element representing the layout-container.
18
- */
19
- this.Layout = new index_1.LayoutModule(this.wire);
20
- }
21
- /**
22
- * Initializes a Platform. Must be called from the Provider when using a custom provider.
23
- * @param options - platform options including a callback function that can be used to extend or replace
24
- * default Provider behavior.
25
- *
26
- * @remarks Must be called from the Provider when using a custom provider.
27
- *
28
- * @example
29
- *
30
- * ```js
31
- * // From Provider context
32
- * await fin.Platform.init();
33
- * // Platform API is now hooked up and windows contained in the manifest snapshot are open.
34
- * ```
35
- *
36
- * `Platform.init` accepts an options object that can contain a callback function which can be used to extend or
37
- * replace default Provider behavior. As an argument, this function will receive the `Provider` class, which is
38
- * used to handle Platform actions. The function must return an object with methods to handle Platform API actions.
39
- * The recommended approach is to extend the `Provider` class, overriding the methods you wish to alter, and return an
40
- * instance of your subclass:
41
- *
42
- * ```js
43
- * const overrideCallback = async (PlatformProvider) => {
44
- * // Actions can be performed before initialization.
45
- * // e.g. we might authenticate a user, set up a Channel, etc before initializing the Platform.
46
- * const { manifestUrl } = await fin.Application.getCurrentSync().getInfo();
47
- *
48
- * // Extend or replace default PlatformProvider behavior by extending the PlatformProvider class.
49
- * class MyOverride extends PlatformProvider {
50
- * // Default behavior can be changed by implementing methods with the same names as those used by the default PlatformProvider.
51
- * async getSnapshot() {
52
- * // Since we are extending the class, we can call `super` methods to access default behavior.
53
- * const snapshot = await super.getSnapshot();
54
- * // But we can modify return values.
55
- * return { ...snapshot, answer: 42, manifestUrl };
56
- * }
57
- * async replaceLayout({ opts, target }) {
58
- * // To disable an API method, overwrite with a noop function.
59
- * return;
60
- * }
61
- * }
62
- * // Return instance with methods to be consumed by Platform.
63
- * // The returned object must implement all methods of the PlatformProvider class.
64
- * // By extending the class, we can simply inherit methods we do not wish to alter.
65
- * return new MyOverride();
66
- * };
67
- *
68
- * fin.Platform.init({overrideCallback});
69
- * ```
70
- * @experimental
71
- * @static
72
- */
73
- async init(options) {
74
- return this.wire.environment.initPlatform(this.fin, options);
75
- }
76
- /**
77
- * Asynchronously returns a Platform object that represents an existing platform.
78
- * @param identity
79
- *
80
- * @example
81
- * ```js
82
- * const { identity } = fin.me;
83
- * const platform = await fin.Platform.wrap(identity);
84
- * // Use wrapped instance to control layout, e.g.:
85
- * const snapshot = await platform.getSnapshot();
86
- * ```
87
- * @static
88
- */
89
- async wrap(identity) {
90
- this.wire.sendAction('platform-wrap').catch((e) => {
91
- // don't expose
92
- });
93
- return new Instance_1.Platform({ uuid: identity.uuid }, this._channel);
94
- }
95
- /**
96
- * Synchronously returns a Platform object that represents an existing platform.
97
- * @param identity
98
- *
99
- * @example
100
- * ```js
101
- * const { identity } = fin.me;
102
- * const platform = fin.Platform.wrapSync(identity);
103
- * // Use wrapped instance to control layout, e.g.:
104
- * const snapshot = await platform.getSnapshot();
105
- * ```
106
- * @static
107
- */
108
- wrapSync(identity) {
109
- this.wire.sendAction('platform-wrap-sync').catch((e) => {
110
- // don't expose
111
- });
112
- return new Instance_1.Platform({ uuid: identity.uuid }, this._channel);
113
- }
114
- /**
115
- * Asynchronously returns a Platform object that represents the current platform.
116
- *
117
- * @example
118
- * ```js
119
- * const platform = await fin.Platform.getCurrent();
120
- * // Use wrapped instance to control layout, e.g.:
121
- * const snapshot = await platform.getSnapshot();
122
- * ```
123
- * @static
124
- */
125
- async getCurrent() {
126
- this.wire.sendAction('platform-get-current').catch((e) => {
127
- // don't expose
128
- });
129
- return this.wrap({ uuid: this.wire.me.uuid });
130
- }
131
- /**
132
- * Synchronously returns a Platform object that represents the current platform.
133
- *
134
- * @example
135
- * ```js
136
- * const platform = fin.Platform.getCurrentSync();
137
- * // Use wrapped instance to control layout, e.g.:
138
- * const snapshot = await platform.getSnapshot();
139
- * ```
140
- * @static
141
- */
142
- getCurrentSync() {
143
- this.wire.sendAction('platform-get-current-sync').catch((e) => {
144
- // don't expose
145
- });
146
- return this.wrapSync({ uuid: this.wire.me.uuid });
147
- }
148
- /**
149
- * Creates and starts a Platform and returns a wrapped and running Platform instance. The wrapped Platform methods can
150
- * be used to launch content into the platform. Promise will reject if the platform is already running.
151
- * @param platformOptions
152
- *
153
- * @example
154
- * ```js
155
- * try {
156
- * const platform = await fin.Platform.start({
157
- * uuid: 'platform-1',
158
- * autoShow: false,
159
- * defaultWindowOptions: {
160
- * stylesheetUrl: 'css-sheet-url',
161
- * cornerRounding: {
162
- * height: 10,
163
- * width: 10
164
- * }
165
- * }
166
- * });
167
- * console.log('Platform is running', platform);
168
- * } catch(e) {
169
- * console.error(e);
170
- * }
171
- * ```
172
- * @static
173
- */
174
- start(platformOptions) {
175
- this.wire.sendAction('platform-start').catch((e) => {
176
- // don't expose
177
- });
178
- // eslint-disable-next-line no-async-promise-executor
179
- return new Promise(async (resolve, reject) => {
180
- try {
181
- const { uuid } = platformOptions;
182
- // @ts-expect-error using private variable.
183
- const app = await this.fin.Application._create({ ...platformOptions, isPlatformController: true });
184
- // TODO: fix typing (internal)
185
- // @ts-expect-error
186
- app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid })));
187
- // @ts-expect-error using private variable.
188
- app._run({ uuid });
189
- }
190
- catch (e) {
191
- reject(e);
192
- }
193
- });
194
- }
195
- /**
196
- * Retrieves platforms's manifest and returns a wrapped and running Platform. If there is a snapshot in the manifest,
197
- * it will be launched into the platform.
198
- * @param manifestUrl - The URL of platform's manifest.
199
- * @param opts - Parameters that the RVM will use.
200
- *
201
- * @example
202
- * ```js
203
- * try {
204
- * const platform = await fin.Platform.startFromManifest('https://openfin.github.io/golden-prototype/public.json');
205
- * console.log('Platform is running, wrapped platform: ', platform);
206
- * } catch(e) {
207
- * console.error(e);
208
- * }
209
- * // For a local manifest file:
210
- * try {
211
- * const platform = await fin.Platform.startFromManifest('file:///C:/somefolder/app.json');
212
- * console.log('Platform is running, wrapped platform: ', platform);
213
- * } catch(e) {
214
- * console.error(e);
215
- * }
216
- * ```
217
- * @static
218
- */
219
- startFromManifest(manifestUrl, opts) {
220
- this.wire.sendAction('platform-start-from-manifest').catch((e) => {
221
- // don't expose
222
- });
223
- // eslint-disable-next-line no-async-promise-executor
224
- return new Promise(async (resolve, reject) => {
225
- try {
226
- // @ts-expect-error using private variable.
227
- const app = await this.fin.Application._createFromManifest(manifestUrl);
228
- // TODO: fix typing (internal)
229
- // @ts-expect-error
230
- app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid: app.identity.uuid })));
231
- // @ts-expect-error using private method without warning.
232
- app._run(opts);
233
- }
234
- catch (e) {
235
- reject(e);
236
- }
237
- });
238
- }
239
- }
240
- exports.default = PlatformModule;