@openfin/core-web 0.39.17 → 0.39.19

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,45 +1,49 @@
1
1
  # @openfin/core-web
2
2
 
3
- `@openfin/core-web` enables interopability within a web browser. It is intended to be used by both content and platform developers to create integrated experiences which leverage OpenFin's existing interopability APIs.
3
+ `@openfin/core-web` enables interoperability and layouts within a web browser. It is intended to be used by both content and platform developers to create integrated experiences which leverage OpenFin's existing interoperability APIs.
4
4
 
5
5
  This package relies on the type definitions found in [@openfin/core](https://www.npmjs.com/package/@openfin/core) which is a required peer dependency.
6
6
 
7
+ ## Built on OpenFin Web-Starter
8
+
9
+ To see more examples of `@openfin/core-web` see the [Built on OpenFin Web-Starter Repository](https://github.com/built-on-openfin/web-starter/).
10
+
7
11
  ## Developer Guides
8
12
 
9
13
  (Please note, these links work in your IDE and not on npm.org, we will update this soon.)
10
14
 
11
- - [Content Developer Guide](docs/web-application-developer-guide.md) - For developers who need access to the `fin` api to build web applications.
12
- - [Platform Developer Guide](docs/platform-developer-guide.md) - For developers building platform-like web experiences who wish to enable and host a Web Interop setup.
15
+ - [Content Developer Guide](docs/web-application-developer-guide.md) - For developers who need access to the `fin` api to build web applications.
16
+ - [Platform Developer Guide](docs/platform-developer-guide.md) - For developers building platform-like web experiences who wish to enable and host a Web Interop setup.
13
17
 
14
18
  ## Supported APIs
15
19
 
16
20
  `@openfin/core-web` currently supports the following APIs:
17
21
 
18
- - `fin.me.identity` - The identity of the `fin` instance provided by the Web Broker.
19
- - `fin.InterApplicationBus.Channel.connect` - Currently, the only supported channel strategy is `classic`.
20
- - `fin.InterApplicationBus.Channel.create`
21
- - `InteropBroker`
22
- - `fin.Interop.init`
23
- - `InteropClient`
24
- - `fin.Interop.connectSync`
25
- - `fin.me.interop`
26
- - `InteropClient.getFDC3()` - (FDC3 support is currently limited to context sharing on User Channels)
27
- - `Layout`
28
- - `fin.Platform.Layout.init`
29
- - `fin.Platform.Layout.create`
30
- - `fin.Platform.Layout.destroy`
31
- - `fin.Platform.Layout.getCurrentLayoutManagerSync`
22
+ - `fin.me.identity` - The identity of the `fin` instance provided by the Web Broker.
23
+ - `fin.InterApplicationBus.Channel.connect` - Currently, the only supported channel strategy is `classic`.
24
+ - `fin.InterApplicationBus.Channel.create`
25
+ - `InteropBroker`
26
+ - `fin.Interop.init`
27
+ - `InteropClient`
28
+ - `fin.Interop.connectSync`
29
+ - `fin.me.interop`
30
+ - `InteropClient.getFDC3()` - (FDC3 support is currently limited to context sharing on User Channels)
31
+ - `Layout`
32
+ - `fin.Platform.Layout.init`
33
+ - `fin.Platform.Layout.create`
34
+ - `fin.Platform.Layout.destroy`
35
+ - `fin.Platform.Layout.getCurrentLayoutManagerSync`
32
36
 
33
37
  ## API Reference
34
38
 
35
39
  (Please note, these links work in your IDE and not on npmjs.com, we will update this soon.)
36
40
 
37
- - [index](out/docs/README.md)
38
- - [@openfin/core-web](out/docs/@openfin/core-web/README.md)
39
- - [@openfin/core-web/iframe-broker](out/docs/@openfin/core-web/iframe-broker/README.md)
40
- - [@openfin/core-web/shared-worker](out/docs/@openfin/core-web/shared-worker/README.md)
41
+ - [index](out/docs/README.md)
42
+ - [@openfin/core-web](out/docs/@openfin/core-web/README.md)
43
+ - [@openfin/core-web/iframe-broker](out/docs/@openfin/core-web/iframe-broker/README.md)
44
+ - [@openfin/core-web/shared-worker](out/docs/@openfin/core-web/shared-worker/README.md)
41
45
 
42
46
  ## See Also
43
47
 
44
- - [OpenFin Container Developer guide](https://developers.openfin.co/of-docs/docs/container-overview)
45
- - [Fin API reference](https://developer.openfin.co/docs/javascript/stable)
48
+ - [OpenFin Container Developer guide](https://developers.openfin.co/of-docs/docs/container-overview)
49
+ - [Fin API reference](https://developer.openfin.co/docs/javascript/stable)
@@ -115,6 +115,14 @@ const layoutSnapshot = {
115
115
 
116
116
  The JSON structure of the underlying layout options is interchangeable, though not identical, between Desktop and Web. Web Layout Snapshots have an optional `web` property within the view `componentState` options which stores web specific properties. This `web` property is ignored on desktop.
117
117
 
118
+ ### Layout Settings
119
+
120
+ Layouts in the web support the following [`LayoutOptions.settings`](https://cdn.openfin.co/docs/javascript/stable/interfaces/OpenFin.LayoutOptions.html#settings):
121
+
122
+ - `reorderEnabled` (Default value **true**): If true, users can re-arrange the layout by dragging items by their tabs to the desired location. Note, unlike in an OpenFin environment the dragging of items is limited to the current window.
123
+ - `hasHeaders` (Default value **true**): Turns tab headers on or off. If false, the layout will be displayed with splitters only.
124
+ - `preventSplitterResize` (Default value **false**): When true the splitters will not be draggable and the layout will not resize.
125
+
118
126
  ### Example: Retrieve a layoutSnapshot from both desktop and web environments
119
127
 
120
128
  From within your OpenFin v34+ Desktop environment, retrieve the current layoutSnapshot:
@@ -219,11 +227,11 @@ Note that cross-tab support is experimental, browser-dependent and respects each
219
227
 
220
228
  (Please note, these links work in your IDE and not on npmjs.com, we will update this soon.)
221
229
 
222
- - [@openfin/core-web](../out/docs/@openfin/core-web/README.md)
223
- - [@openfin/core-web/iframe-broker](../out/docs/@openfin/core-web/iframe-broker/README.md)
224
- - [@openfin/core-web/shared-worker](../out/docs/@openfin/core-web/shared-worker/README.md)
230
+ - [@openfin/core-web](../out/docs/@openfin/core-web/README.md)
231
+ - [@openfin/core-web/iframe-broker](../out/docs/@openfin/core-web/iframe-broker/README.md)
232
+ - [@openfin/core-web/shared-worker](../out/docs/@openfin/core-web/shared-worker/README.md)
225
233
 
226
234
  ## See Also
227
235
 
228
- - [OpenFin Container Developer guide](https://developers.openfin.co/of-docs/docs/container-overview)
229
- - [Fin API reference](https://developer.openfin.co/docs/javascript/stable)
236
+ - [OpenFin Container Developer guide](https://developers.openfin.co/of-docs/docs/container-overview)
237
+ - [Fin API reference](https://developer.openfin.co/docs/javascript/stable)
@@ -1,4 +1,4 @@
1
- import type OpenFin from '@openfin/core';
1
+ import OpenFin from '@openfin/core';
2
2
 
3
3
  export declare type BaseConfig = {
4
4
  /**
@@ -49,6 +49,8 @@ export declare const connect: (connectConfig: ConnectConfig) => Promise<OpenFin.
49
49
 
50
50
  export declare type ConnectConfig = StandAloneConnectConfig | InheritModeConnectConfig;
51
51
 
52
+ declare type GL2Types = OpenFin.LayoutEntityTypes | 'component' | 'root' | 'ground';
53
+
52
54
  export declare type InheritModeConnectConfig = BaseConfig & {
53
55
  /**
54
56
  * @defaultValue 'disabled'
@@ -91,6 +93,8 @@ export declare type StandAloneConnectConfig = BaseConfig & {
91
93
  options: BaseConnectionOptions;
92
94
  };
93
95
 
96
+ export declare type ViewComponentConfig = WebLayoutComponent['componentState'];
97
+
94
98
  export declare type WebCreateLayoutOptions = Omit<OpenFin.CreateLayoutOptions, 'layout'> & {
95
99
  layout: WebLayoutOptions;
96
100
  };
@@ -100,7 +104,7 @@ declare type WebLayoutColumn = OpenFin.LayoutColumn & WebLayoutItemConfig;
100
104
  /**
101
105
  * Web-only component supplied to IframeViewComponent as it's config
102
106
  */
103
- export declare type WebLayoutComponent = OpenFin.LayoutComponent & {
107
+ export declare type WebLayoutComponent = Omit<OpenFin.LayoutComponent, 'componentState'> & {
104
108
  componentState?: OpenFin.LayoutComponent['componentState'] & {
105
109
  web?: WebState;
106
110
  };
@@ -112,10 +116,13 @@ export declare type WebLayoutInitOptions = Omit<OpenFin.InitLayoutOptions, 'layo
112
116
  layoutManagerOverride?: OpenFin.LayoutManagerOverride<WebLayoutSnapshot>;
113
117
  };
114
118
 
115
- declare type WebLayoutItemConfig = Omit<OpenFin.LayoutItemConfig, 'content'> & {
119
+ declare type WebLayoutItemConfig = Omit<OpenFin.LayoutItemConfig, 'content' | 'type'> & {
116
120
  content?: WebLayoutContent;
121
+ type: GL2Types;
117
122
  };
118
123
 
124
+ export declare type WebLayoutManager = OpenFin.LayoutManager<WebLayoutSnapshot>;
125
+
119
126
  export declare type WebLayoutOptions = Omit<OpenFin.LayoutOptions, 'content'> & {
120
127
  content?: WebLayoutContent;
121
128
  };
package/out/api-client.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("./main-b06f22cd.js");require("buffer/"),require("uuid"),require("events"),require("lodash"),exports.connect=e.connect;
1
+ "use strict";var e=require("./main-5ddd684d.js");require("buffer/"),require("uuid"),require("events"),require("lodash/cloneDeep"),require("lodash/isEqual"),exports.connect=e.connect;
@@ -37,9 +37,11 @@ const fin = await connect({
37
37
  - [ConnectConfig](type-aliases/ConnectConfig.md)
38
38
  - [InheritModeConnectConfig](type-aliases/InheritModeConnectConfig.md)
39
39
  - [StandAloneConnectConfig](type-aliases/StandAloneConnectConfig.md)
40
+ - [ViewComponentConfig](type-aliases/ViewComponentConfig.md)
40
41
  - [WebCreateLayoutOptions](type-aliases/WebCreateLayoutOptions.md)
41
42
  - [WebLayoutComponent](type-aliases/WebLayoutComponent.md)
42
43
  - [WebLayoutInitOptions](type-aliases/WebLayoutInitOptions.md)
44
+ - [WebLayoutManager](type-aliases/WebLayoutManager.md)
43
45
  - [WebLayoutOptions](type-aliases/WebLayoutOptions.md)
44
46
  - [WebLayoutPlatformOptions](type-aliases/WebLayoutPlatformOptions.md)
45
47
  - [WebLayoutSnapshot](type-aliases/WebLayoutSnapshot.md)
@@ -0,0 +1,9 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / ViewComponentConfig
6
+
7
+ # Type alias: ViewComponentConfig
8
+
9
+ > **ViewComponentConfig**: [`WebLayoutComponent`](WebLayoutComponent.md)\[`"componentState"`\]
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: WebLayoutComponent
8
8
 
9
- > **WebLayoutComponent**: `OpenFin.LayoutComponent` & `object`
9
+ > **WebLayoutComponent**: `Omit`\<`OpenFin.LayoutComponent`, `"componentState"`\> & `object`
10
10
 
11
11
  Web-only component supplied to IframeViewComponent as it's config
12
12
 
@@ -0,0 +1,9 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutManager
6
+
7
+ # Type alias: WebLayoutManager
8
+
9
+ > **WebLayoutManager**: `OpenFin.LayoutManager`\<[`WebLayoutSnapshot`](WebLayoutSnapshot.md)\>
@@ -1 +1 @@
1
- "use strict";const e="web-broker-ports-ready",t="worker-initialize-connection",r="create-fallback-connection",i="request-fallback-connection",o=e=>`ack-${e}`,n=(...e)=>({log:(...t)=>console.log(`[${(new Date).toISOString()}]`,...(e=>e.map((e=>`[${e}]`)))(e),...t),getLogger:(...t)=>n(...e,...t)});class s{static get lockApi(){return navigator.locks}constructor(e){this.name=e,this.releaseCallback=null,s.pending.add(this),this.lockAcquiredPromise=new Promise(((e,t)=>{this.lockReleasedPromise=s.lockApi.request(this.name,(()=>(s.pending.delete(this),e(),new Promise((e=>{s.held.add(this),this.releaseCallback=e}))))).catch((e=>{throw t(e),e}))}))}async acquired(){await this.lockAcquiredPromise}async release(){if(!this.releaseCallback)throw new Error(`Lock ${this.name} not acquired.`);this.releaseCallback(),this.releaseCallback=null,await this.lockReleasedPromise,s.held.delete(this)}async onReleased(e){if(!this.lockReleasedPromise)throw new Error(`Lock ${this.name} not queued.`);return this.lockReleasedPromise.then(e)}autoRelease(){this.acquired().then((()=>this.release()))}static async releaseAll(){const e=Promise.all([...this.pending].map((async e=>{await e.acquired(),await e.release()})));await Promise.all([...this.held].map((async e=>{await e.release()}))),await e}}s.pending=new Set,s.held=new Set;const a=e=>window.top===e,c=(e,t)=>{try{return e.origin===t.origin}catch(e){return!1}},d="openfin/web-shared-worker";class h{constructor(e,t,n){this.workerUrl=e,this.iframeWindow=t,this.forceWorker=n,this.isSharedWorkerSupported=()=>!this.forceWorker&&!!window.SharedWorker,this.state="ready",this.establishWorkerConnectionViaWindow=async e=>{if(c(this.iframeWindow,e)){const t=new MessageChannel;return new Promise(((n,s)=>{t.port1.addEventListener("message",(e=>{e.data.topic===o(r)&&(e.data.success?n(t.port1):s(e.data.reason))})),t.port1.start();const a={topic:i};e.postMessage(a,location.origin,[t.port2])}))}throw new Error("Could not connect via top level browsing context as its origin does not much the web interop broker.")},this.listenForNestedConnections=e=>{"top-window"===this.state&&c(this.iframeWindow,this.iframeWindow.parent)&&this.iframeWindow.parent.addEventListener("message",(t=>{if(t.origin===location.origin&&t.data.topic===i){const[i]=t.ports,o={topic:r};e.postMessage(o,[i])}}))},this.initialize=async()=>{if("ready"!==this.state)throw new Error("Worker connection already initialized");if((e=>{const t=r=>!(!(e=>{try{return!e.origin}catch(e){return!0}})(r)&&r.origin===e.origin)||!a(r)&&t(r.parent);return!a(e)&&t(e.parent)})(this.iframeWindow)&&c(this.iframeWindow,this.iframeWindow.top))return this.state="partitioned-frame",this.establishWorkerConnectionViaWindow(this.iframeWindow.top);if(a(this.iframeWindow.parent)){let e;return this.state="top-window",e=this.isSharedWorkerSupported()?new SharedWorker(this.workerUrl,d).port:new Worker(this.workerUrl),this.listenForNestedConnections(e),e}{if(this.state="frame",!this.isSharedWorkerSupported())try{return await this.establishWorkerConnectionViaWindow(this.iframeWindow.top)}catch(e){throw new Error(`SharedWorker is not supported and an unexpected error occured when trying to connect via fallback mechanism: ${e.message}`)}const{port:e}=new SharedWorker(this.workerUrl,d);return e}}}}const l=n("@openfin/core-web/iframe-broker"),w=()=>{const e=((e,t)=>{const r=new RegExp(`^${t}<(?<meta>.*)>$`).exec(e)?.groups?.meta;if(r)try{return JSON.parse(atob(r))}catch(e){throw new Error(`Failed to decode JSON from ${r}.`)}})(window.name,"of-broker");if(!e)throw new Error("Invalid or missing identity string in iframe context. Ensure that this iframe is being renderered via the @openfin/core-web library.");return e};function p(t){const r={topic:o(e),success:!1,reason:t?.reason??"Connection Rejected"};window.parent.postMessage(r,"*")}exports.init=async r=>{try{const{sharedWorkerUrl:i}=r;await("loading"===document.readyState?new Promise((e=>{const t=()=>{e(),window.removeEventListener("DOMContentLoaded",t)};window.addEventListener("DOMContentLoaded",t)})):Promise.resolve());const n=w(),a=new h(i,window,"same-site"!==r.experimental?.crossTab),c=await a.initialize();l.log(`Loading ${i} in ${a.state} mode...`);const d=await(async(r,i,n)=>{const a=new MessageChannel,c=new MessageChannel,d={topic:t,payload:{identity:n}},h=new s((e=>`__OPENFIN__${e.uuid}_${e.name}`)(n));await h.acquired(),await new Promise(((e,r)=>{i.addEventListener("message",(i=>{i.data.topic===o(t)&&(i.data.success?e():r(new Error(i.data.reason)))})),i.start?.(),i.postMessage(d,[c.port2])}));const l={topic:o(e),success:!0,payload:{identity:n}};return r.postMessage(l,"*",[a.port2,c.port1]),a.port1})(window.parent,c,n);d.start(),c.start?.(),l.log(`Port transfer complete in ${a.state} mode. Connection established with identity ${JSON.stringify(n)}. SharedWorker support=${a.isSharedWorkerSupported()}`)}catch(e){const t=new Error(`An unexpected error occured during initialization. ${e.message}`);p({reason:t.message}),console.error(t)}},exports.rejectConnections=p;
1
+ "use strict";const e="web-broker-ports-ready",t="worker-initialize-connection",i="create-fallback-connection",r="request-fallback-connection",n=e=>`ack-${e}`,o=(...e)=>({log:(...t)=>console.debug(`[${(new Date).toISOString()}]`,...(e=>e.map((e=>`[${e}]`)))(e),...t),getLogger:(...t)=>o(...e,...t)}),s=e=>window.top===e,a=(e,t)=>{try{return e.origin===t.origin}catch(e){return!1}},c="openfin/web-shared-worker";class d{static get lockApi(){return navigator.locks}constructor(e){this.name=e,this.releaseCallback=null,d.pending.add(this),this.lockAcquiredPromise=new Promise(((e,t)=>{this.lockReleasedPromise=d.lockApi.request(this.name,(()=>(d.pending.delete(this),e(),new Promise((e=>{d.held.add(this),this.releaseCallback=e}))))).catch((e=>{throw t(e),e}))}))}async acquired(){await this.lockAcquiredPromise}async release(){if(!this.releaseCallback)throw new Error(`Lock ${this.name} not acquired.`);this.releaseCallback(),this.releaseCallback=null,await this.lockReleasedPromise,d.held.delete(this)}async onReleased(e){if(!this.lockReleasedPromise)throw new Error(`Lock ${this.name} not queued.`);return this.lockReleasedPromise.then(e)}autoRelease(){this.acquired().then((()=>this.release()))}static async releaseAll(){const e=Promise.all([...this.pending].map((async e=>{await e.acquired(),await e.release()})));await Promise.all([...this.held].map((async e=>{await e.release()}))),await e}}d.pending=new Set,d.held=new Set;class l{constructor(e=100,t=2){this.pingIntervalMs=e,this.allowedMissedPings=t,this.lockSelf=async e=>{const t=new d((e=>`__OPENFIN__${e.uuid}_${e.name}`)(e));return await t.acquired(),t}}async lockProxiedConnection(e,t){let i=0;t.addEventListener("message",(e=>{"pong"===e.data.topic&&i--}));const r=await this.lockSelf(e);let n=setInterval((()=>{i>=this.allowedMissedPings?(r.release(),clearInterval(n)):(i++,t.postMessage({topic:"ping"}))}),this.pingIntervalMs);t.start()}registerProxiedConnection(e){e.addEventListener("message",(t=>{"ping"===t.data.topic&&e.postMessage({topic:"pong"})})),e.start()}}class h{constructor(e,t,o){this.workerUrl=e,this.iframeWindow=t,this.forceWorker=o,this.identityDisconnectionController=new l,this.isSharedWorkerSupported=()=>!this.forceWorker&&!!window.SharedWorker,this.state="ready",this.establishWorkerConnectionViaWindow=async(e,t)=>{if(a(this.iframeWindow,e)){const o=new MessageChannel,s=new MessageChannel;return this.identityDisconnectionController.registerProxiedConnection(s.port1),new Promise(((a,c)=>{o.port1.addEventListener("message",(e=>{e.data.topic===n(i)&&(e.data.success?a(o.port1):c(e.data.reason))})),o.port1.start();const d={topic:r,payload:{identity:t}};e.postMessage(d,location.origin,[o.port2,s.port2])}))}throw new Error("Could not connect via top level browsing context as its origin does not much the web interop broker.")},this.listenForNestedConnections=e=>{"top-window"===this.state&&a(this.iframeWindow,this.iframeWindow.parent)&&this.iframeWindow.parent.addEventListener("message",(async t=>{const{data:n}=t;if(t.origin===location.origin&&n.topic===r){const[r,...o]=t.ports;if(o.length>0&&n.payload?.identity){const[e]=o;await this.identityDisconnectionController.lockProxiedConnection(n.payload.identity,e)}const s={topic:i};e.postMessage(s,[r])}}))},this.initialize=async e=>{if("ready"!==this.state)throw new Error("Worker connection already initialized");return(e=>{const t=i=>!(!(e=>{try{return!e.origin}catch(e){return!0}})(i)&&i.origin===e.origin)||!s(i)&&t(i.parent);return!s(e)&&t(e.parent)})(this.iframeWindow)&&a(this.iframeWindow,this.iframeWindow.top)?this.state="partitioned-frame":s(this.iframeWindow.parent)?this.state="top-window":this.state="frame",this.connect(e)}}async connect(e){if("ready"===this.state)throw new Error("Must call initialize before connect");switch(this.state){case"partitioned-frame":return this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e);case"top-window":{let t;return t=this.isSharedWorkerSupported()?new SharedWorker(this.workerUrl,c).port:new Worker(this.workerUrl),await this.identityDisconnectionController.lockSelf(e),this.listenForNestedConnections(t),t}case"frame":{if(!this.isSharedWorkerSupported())try{return await this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e)}catch(e){throw new Error(`SharedWorker is not supported and an unexpected error occured when trying to connect via fallback mechanism: ${e.message}`,{cause:e})}await this.identityDisconnectionController.lockSelf(e);const{port:t}=new SharedWorker(this.workerUrl,c);return t}default:throw this.state,new Error(`Invalid state: ${this.state}`)}}}const w=o("@openfin/core-web/iframe-broker"),p=()=>{const e=((e,t)=>{const i=new RegExp(`^${t}<(?<meta>.*)>$`).exec(e)?.groups?.meta;if(i)try{return JSON.parse(atob(i))}catch(e){throw new Error(`Failed to decode JSON from ${i}.`)}})(window.name,"of-broker");if(!e)throw new Error("Invalid or missing identity string in iframe context. Ensure that this iframe is being renderered via the @openfin/core-web library.");return e};function g(t){const i={topic:n(e),success:!1,reason:t?.reason??"Connection Rejected"};window.parent.postMessage(i,"*")}exports.init=async i=>{try{const{sharedWorkerUrl:r}=i;await("loading"===document.readyState?new Promise((e=>{const t=()=>{e(),window.removeEventListener("DOMContentLoaded",t)};window.addEventListener("DOMContentLoaded",t)})):Promise.resolve());const o=p(),s=new h(r,window,"same-site"!==i.experimental?.crossTab),a=await s.initialize(o);w.log(`Loading ${r} in ${s.state} mode...`);const c=await(async(i,r,o)=>{const s=new MessageChannel,a=new MessageChannel,c={topic:t,payload:{identity:o}};await new Promise(((e,i)=>{r.addEventListener("message",(r=>{r.data.topic===n(t)&&(r.data.success?e():i(new Error(r.data.reason)))})),r.start?.(),r.postMessage(c,[a.port2])}));const d={topic:n(e),success:!0,payload:{identity:o}};return i.postMessage(d,"*",[s.port2,a.port1]),s.port1})(window.parent,a,o);c.start(),a.start?.(),w.log(`Port transfer complete in ${s.state} mode. Connection established with identity ${JSON.stringify(o)}. SharedWorker support=${s.isSharedWorkerSupported()}`)}catch(e){const t=new Error(`An unexpected error occured during initialization. ${e.message}`);g({reason:t.message}),console.error(t)}},exports.rejectConnections=g;