@openfin/remote-adapter 36.78.7 → 36.78.13

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var bridge = require('./bridge-e92ef6b7.js');
3
+ var bridge = require('./bridge-ef11968f.js');
4
4
 
5
5
  exports.eventsExports = {};
6
6
  var events = {
@@ -482,19 +482,19 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
482
482
  }
483
483
  }
484
484
 
485
- class BackChannel extends exports.eventsExports.EventEmitter {
486
- constructor(datachannel) {
487
- super();
488
- this.datachannel = datachannel;
489
- this.onmessage = (message) => {
490
- const data = JSON.parse(message.data);
491
- this.emit(data.type, data);
492
- };
493
- this.send = (data) => {
494
- this.datachannel.send(JSON.stringify(data));
495
- };
496
- this.opened = bridge.initializeMessageReceiver(datachannel, this.onmessage, () => this.emit('closed', { type: 'closed' }));
497
- }
485
+ class BackChannel extends exports.eventsExports.EventEmitter {
486
+ constructor(datachannel) {
487
+ super();
488
+ this.datachannel = datachannel;
489
+ this.onmessage = (message) => {
490
+ const data = JSON.parse(message.data);
491
+ this.emit(data.type, data);
492
+ };
493
+ this.send = (data) => {
494
+ this.datachannel.send(JSON.stringify(data));
495
+ };
496
+ this.opened = bridge.initializeMessageReceiver(datachannel, this.onmessage, () => this.emit('closed', { type: 'closed' }));
497
+ }
498
498
  }
499
499
 
500
500
  exports.BackChannel = BackChannel;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var backchannel = require('./backchannel-ce544f7d.js');
4
- require('./bridge-e92ef6b7.js');
3
+ var backchannel = require('./backchannel-e240e597.js');
4
+ require('./bridge-ef11968f.js');
5
5
 
6
6
 
7
7
 
@@ -2,71 +2,71 @@
2
2
 
3
3
  var messageReceiver = {};
4
4
 
5
- Object.defineProperty(messageReceiver, "__esModule", { value: true });
6
- var isOpen_1 = messageReceiver.isOpen = void 0;
7
- function isOpen(receiver) {
8
- return receiver.readyState === 'open' || receiver.readyState === 1;
9
- }
5
+ Object.defineProperty(messageReceiver, "__esModule", { value: true });
6
+ var isOpen_1 = messageReceiver.isOpen = void 0;
7
+ function isOpen(receiver) {
8
+ return receiver.readyState === 'open' || receiver.readyState === 1;
9
+ }
10
10
  isOpen_1 = messageReceiver.isOpen = isOpen;
11
11
 
12
- async function initializeMessageReceiver(socket, onmessage, onclose) {
13
- return new Promise((resolve, reject) => {
14
- socket.addEventListener('open', () => resolve());
15
- socket.addEventListener('error', reject);
16
- if (onmessage) {
17
- socket.addEventListener('message', onmessage);
18
- }
19
- if (onclose) {
20
- socket.addEventListener('close', onclose);
21
- }
22
- if (isOpen_1(socket)) {
23
- resolve();
24
- }
25
- });
26
- }
27
- async function bridge(local, remote) {
28
- const onMessage = (other) => (event) => {
29
- if (isOpen_1(other)) {
30
- other.send(event.data);
31
- }
32
- };
33
- await Promise.all([
34
- initializeMessageReceiver(local, onMessage(remote), () => remote.close()),
35
- initializeMessageReceiver(remote, onMessage(local), () => local.close())
36
- ]);
37
- }
38
- function createOpenedDataChannel(label, rtc) {
39
- const datachannel = rtc.createDataChannel(label);
40
- return new Promise((resolve) => {
41
- const listener = () => {
42
- datachannel.removeEventListener('open', listener);
43
- resolve(datachannel);
44
- };
45
- datachannel.addEventListener('open', listener);
46
- });
47
- }
48
- function waitForDataChannel(label, rtc) {
49
- let resolver;
50
- const dataChannelPromise = new Promise((resolve) => {
51
- resolver = resolve;
52
- });
53
- const listener = (event) => {
54
- const openListener = () => {
55
- event.channel.removeEventListener('open', openListener);
56
- resolver(event.channel);
57
- };
58
- if (event.channel.label === label) {
59
- event.channel.addEventListener('open', openListener);
60
- rtc.removeEventListener('datachannel', listener);
61
- }
62
- };
63
- rtc.addEventListener('datachannel', listener);
64
- return dataChannelPromise;
65
- }
66
- function promisifyOnce(emitter, eventName) {
67
- return new Promise((resolve) => {
68
- emitter.once(eventName, resolve);
69
- });
12
+ async function initializeMessageReceiver(socket, onmessage, onclose) {
13
+ return new Promise((resolve, reject) => {
14
+ socket.addEventListener('open', () => resolve());
15
+ socket.addEventListener('error', reject);
16
+ if (onmessage) {
17
+ socket.addEventListener('message', onmessage);
18
+ }
19
+ if (onclose) {
20
+ socket.addEventListener('close', onclose);
21
+ }
22
+ if (isOpen_1(socket)) {
23
+ resolve();
24
+ }
25
+ });
26
+ }
27
+ async function bridge(local, remote) {
28
+ const onMessage = (other) => (event) => {
29
+ if (isOpen_1(other)) {
30
+ other.send(event.data);
31
+ }
32
+ };
33
+ await Promise.all([
34
+ initializeMessageReceiver(local, onMessage(remote), () => remote.close()),
35
+ initializeMessageReceiver(remote, onMessage(local), () => local.close())
36
+ ]);
37
+ }
38
+ function createOpenedDataChannel(label, rtc) {
39
+ const datachannel = rtc.createDataChannel(label);
40
+ return new Promise((resolve) => {
41
+ const listener = () => {
42
+ datachannel.removeEventListener('open', listener);
43
+ resolve(datachannel);
44
+ };
45
+ datachannel.addEventListener('open', listener);
46
+ });
47
+ }
48
+ function waitForDataChannel(label, rtc) {
49
+ let resolver;
50
+ const dataChannelPromise = new Promise((resolve) => {
51
+ resolver = resolve;
52
+ });
53
+ const listener = (event) => {
54
+ const openListener = () => {
55
+ event.channel.removeEventListener('open', openListener);
56
+ resolver(event.channel);
57
+ };
58
+ if (event.channel.label === label) {
59
+ event.channel.addEventListener('open', openListener);
60
+ rtc.removeEventListener('datachannel', listener);
61
+ }
62
+ };
63
+ rtc.addEventListener('datachannel', listener);
64
+ return dataChannelPromise;
65
+ }
66
+ function promisifyOnce(emitter, eventName) {
67
+ return new Promise((resolve) => {
68
+ emitter.once(eventName, resolve);
69
+ });
70
70
  }
71
71
 
72
72
  exports.bridge = bridge;
package/out/bridge.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var bridge = require('./bridge-e92ef6b7.js');
3
+ var bridge = require('./bridge-ef11968f.js');
4
4
 
5
5
 
6
6
 
package/out/constants.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const PRIMARY_NAME = 'wire';
4
- const SECONDARY_NAME = 'backchannel';
5
- const REMOTE_READY = 'remote-ready';
3
+ const PRIMARY_NAME = 'wire';
4
+ const SECONDARY_NAME = 'backchannel';
5
+ const REMOTE_READY = 'remote-ready';
6
6
  const HOST_READY = 'host-ready';
7
7
 
8
8
  exports.HOST_READY = HOST_READY;
@@ -1,48 +1,48 @@
1
- import * as OpenFin from 'openfin-adapter/OpenFin';
2
-
3
- /**
4
- * Connect remotely to another OpenFin runtime using a WebRTC peer.
5
- * Returned `fin` will proxy all API calls to the "host" application.
6
- * If `wait` is `true` than `connect` will resolve once the host application calls `init`.
7
- * If the host application already called `init` the bridge will be established immediately.
8
- * @param {ConnectOptions} options connect options
9
- * @throws If `wait` is `false` and the host application does not call `init` within a timeout
10
- * @returns {OpenFin.Fin<'external connection'>} `fin` API
11
- */
12
- export declare function connect(options: ConnectOptions): Promise<{
13
- fin: OpenFin.Fin<'external connection'>;
14
- }>;
15
-
16
- export declare type ConnectOptions = {
17
- /**
18
- * WebRTC peer connection.
19
- */
20
- rtc: RTCPeerConnection;
21
- /**
22
- * If `connect` should wait for host application to call `init`, defaults to `true`.
23
- */
24
- wait?: boolean;
25
- };
26
-
27
- /**
28
- * Initialize a remote connection as a "host" application.
29
- * @param {InitOptions} options init options
30
- */
31
- export declare function init(options: InitOptions): Promise<void>;
32
-
33
- export declare type InitOptions = {
34
- /**
35
- * `fin` API
36
- */
37
- fin: OpenFin.Fin<OpenFin.EntityType>;
38
- /**
39
- * WebRTC peer connection.
40
- */
41
- rtc: RTCPeerConnection;
42
- /**
43
- * Unique identifier for the remote external connection.
44
- */
45
- uuid?: string;
46
- };
47
-
48
- export { }
1
+ import * as OpenFin from 'openfin-adapter/OpenFin';
2
+
3
+ /**
4
+ * Connect remotely to another OpenFin runtime using a WebRTC peer.
5
+ * Returned `fin` will proxy all API calls to the "host" application.
6
+ * If `wait` is `true` than `connect` will resolve once the host application calls `init`.
7
+ * If the host application already called `init` the bridge will be established immediately.
8
+ * @param {ConnectOptions} options connect options
9
+ * @throws If `wait` is `false` and the host application does not call `init` within a timeout
10
+ * @returns {OpenFin.Fin<'external connection'>} `fin` API
11
+ */
12
+ export declare function connect(options: ConnectOptions): Promise<{
13
+ fin: OpenFin.Fin<'external connection'>;
14
+ }>;
15
+
16
+ export declare type ConnectOptions = {
17
+ /**
18
+ * WebRTC peer connection.
19
+ */
20
+ rtc: RTCPeerConnection;
21
+ /**
22
+ * If `connect` should wait for host application to call `init`, defaults to `true`.
23
+ */
24
+ wait?: boolean;
25
+ };
26
+
27
+ /**
28
+ * Initialize a remote connection as a "host" application.
29
+ * @param {InitOptions} options init options
30
+ */
31
+ export declare function init(options: InitOptions): Promise<void>;
32
+
33
+ export declare type InitOptions = {
34
+ /**
35
+ * `fin` API
36
+ */
37
+ fin: OpenFin.Fin<OpenFin.EntityType>;
38
+ /**
39
+ * WebRTC peer connection.
40
+ */
41
+ rtc: RTCPeerConnection;
42
+ /**
43
+ * Unique identifier for the remote external connection.
44
+ */
45
+ uuid?: string;
46
+ };
47
+
48
+ export { }
@@ -1,48 +1,48 @@
1
- import * as OpenFin from 'openfin-adapter/OpenFin';
2
-
3
- /**
4
- * Connect remotely to another OpenFin runtime using a WebRTC peer.
5
- * Returned `fin` will proxy all API calls to the "host" application.
6
- * If `wait` is `true` than `connect` will resolve once the host application calls `init`.
7
- * If the host application already called `init` the bridge will be established immediately.
8
- * @param {ConnectOptions} options connect options
9
- * @throws If `wait` is `false` and the host application does not call `init` within a timeout
10
- * @returns {OpenFin.Fin<'external connection'>} `fin` API
11
- */
12
- export declare function connect(options: ConnectOptions): Promise<{
13
- fin: OpenFin.Fin<'external connection'>;
14
- }>;
15
-
16
- export declare type ConnectOptions = {
17
- /**
18
- * WebRTC peer connection.
19
- */
20
- rtc: RTCPeerConnection;
21
- /**
22
- * If `connect` should wait for host application to call `init`, defaults to `true`.
23
- */
24
- wait?: boolean;
25
- };
26
-
27
- /**
28
- * Initialize a remote connection as a "host" application.
29
- * @param {InitOptions} options init options
30
- */
31
- export declare function init(options: InitOptions): Promise<void>;
32
-
33
- export declare type InitOptions = {
34
- /**
35
- * `fin` API
36
- */
37
- fin: OpenFin.Fin<OpenFin.EntityType>;
38
- /**
39
- * WebRTC peer connection.
40
- */
41
- rtc: RTCPeerConnection;
42
- /**
43
- * Unique identifier for the remote external connection.
44
- */
45
- uuid?: string;
46
- };
47
-
48
- export { }
1
+ import * as OpenFin from 'openfin-adapter/OpenFin';
2
+
3
+ /**
4
+ * Connect remotely to another OpenFin runtime using a WebRTC peer.
5
+ * Returned `fin` will proxy all API calls to the "host" application.
6
+ * If `wait` is `true` than `connect` will resolve once the host application calls `init`.
7
+ * If the host application already called `init` the bridge will be established immediately.
8
+ * @param {ConnectOptions} options connect options
9
+ * @throws If `wait` is `false` and the host application does not call `init` within a timeout
10
+ * @returns {OpenFin.Fin<'external connection'>} `fin` API
11
+ */
12
+ export declare function connect(options: ConnectOptions): Promise<{
13
+ fin: OpenFin.Fin<'external connection'>;
14
+ }>;
15
+
16
+ export declare type ConnectOptions = {
17
+ /**
18
+ * WebRTC peer connection.
19
+ */
20
+ rtc: RTCPeerConnection;
21
+ /**
22
+ * If `connect` should wait for host application to call `init`, defaults to `true`.
23
+ */
24
+ wait?: boolean;
25
+ };
26
+
27
+ /**
28
+ * Initialize a remote connection as a "host" application.
29
+ * @param {InitOptions} options init options
30
+ */
31
+ export declare function init(options: InitOptions): Promise<void>;
32
+
33
+ export declare type InitOptions = {
34
+ /**
35
+ * `fin` API
36
+ */
37
+ fin: OpenFin.Fin<OpenFin.EntityType>;
38
+ /**
39
+ * WebRTC peer connection.
40
+ */
41
+ rtc: RTCPeerConnection;
42
+ /**
43
+ * Unique identifier for the remote external connection.
44
+ */
45
+ uuid?: string;
46
+ };
47
+
48
+ export { }
@@ -1,48 +1,48 @@
1
- import * as OpenFin from 'openfin-adapter/OpenFin';
2
-
3
- /**
4
- * Connect remotely to another OpenFin runtime using a WebRTC peer.
5
- * Returned `fin` will proxy all API calls to the "host" application.
6
- * If `wait` is `true` than `connect` will resolve once the host application calls `init`.
7
- * If the host application already called `init` the bridge will be established immediately.
8
- * @param {ConnectOptions} options connect options
9
- * @throws If `wait` is `false` and the host application does not call `init` within a timeout
10
- * @returns {OpenFin.Fin<'external connection'>} `fin` API
11
- */
12
- export declare function connect(options: ConnectOptions): Promise<{
13
- fin: OpenFin.Fin<'external connection'>;
14
- }>;
15
-
16
- export declare type ConnectOptions = {
17
- /**
18
- * WebRTC peer connection.
19
- */
20
- rtc: RTCPeerConnection;
21
- /**
22
- * If `connect` should wait for host application to call `init`, defaults to `true`.
23
- */
24
- wait?: boolean;
25
- };
26
-
27
- /**
28
- * Initialize a remote connection as a "host" application.
29
- * @param {InitOptions} options init options
30
- */
31
- export declare function init(options: InitOptions): Promise<void>;
32
-
33
- export declare type InitOptions = {
34
- /**
35
- * `fin` API
36
- */
37
- fin: OpenFin.Fin<OpenFin.EntityType>;
38
- /**
39
- * WebRTC peer connection.
40
- */
41
- rtc: RTCPeerConnection;
42
- /**
43
- * Unique identifier for the remote external connection.
44
- */
45
- uuid?: string;
46
- };
47
-
48
- export { }
1
+ import * as OpenFin from 'openfin-adapter/OpenFin';
2
+
3
+ /**
4
+ * Connect remotely to another OpenFin runtime using a WebRTC peer.
5
+ * Returned `fin` will proxy all API calls to the "host" application.
6
+ * If `wait` is `true` than `connect` will resolve once the host application calls `init`.
7
+ * If the host application already called `init` the bridge will be established immediately.
8
+ * @param {ConnectOptions} options connect options
9
+ * @throws If `wait` is `false` and the host application does not call `init` within a timeout
10
+ * @returns {OpenFin.Fin<'external connection'>} `fin` API
11
+ */
12
+ export declare function connect(options: ConnectOptions): Promise<{
13
+ fin: OpenFin.Fin<'external connection'>;
14
+ }>;
15
+
16
+ export declare type ConnectOptions = {
17
+ /**
18
+ * WebRTC peer connection.
19
+ */
20
+ rtc: RTCPeerConnection;
21
+ /**
22
+ * If `connect` should wait for host application to call `init`, defaults to `true`.
23
+ */
24
+ wait?: boolean;
25
+ };
26
+
27
+ /**
28
+ * Initialize a remote connection as a "host" application.
29
+ * @param {InitOptions} options init options
30
+ */
31
+ export declare function init(options: InitOptions): Promise<void>;
32
+
33
+ export declare type InitOptions = {
34
+ /**
35
+ * `fin` API
36
+ */
37
+ fin: OpenFin.Fin<OpenFin.EntityType>;
38
+ /**
39
+ * WebRTC peer connection.
40
+ */
41
+ rtc: RTCPeerConnection;
42
+ /**
43
+ * Unique identifier for the remote external connection.
44
+ */
45
+ uuid?: string;
46
+ };
47
+
48
+ export { }
@@ -1,48 +1,48 @@
1
- import * as OpenFin from 'openfin-adapter/OpenFin';
2
-
3
- /**
4
- * Connect remotely to another OpenFin runtime using a WebRTC peer.
5
- * Returned `fin` will proxy all API calls to the "host" application.
6
- * If `wait` is `true` than `connect` will resolve once the host application calls `init`.
7
- * If the host application already called `init` the bridge will be established immediately.
8
- * @param {ConnectOptions} options connect options
9
- * @throws If `wait` is `false` and the host application does not call `init` within a timeout
10
- * @returns {OpenFin.Fin<'external connection'>} `fin` API
11
- */
12
- export declare function connect(options: ConnectOptions): Promise<{
13
- fin: OpenFin.Fin<'external connection'>;
14
- }>;
15
-
16
- export declare type ConnectOptions = {
17
- /**
18
- * WebRTC peer connection.
19
- */
20
- rtc: RTCPeerConnection;
21
- /**
22
- * If `connect` should wait for host application to call `init`, defaults to `true`.
23
- */
24
- wait?: boolean;
25
- };
26
-
27
- /**
28
- * Initialize a remote connection as a "host" application.
29
- * @param {InitOptions} options init options
30
- */
31
- export declare function init(options: InitOptions): Promise<void>;
32
-
33
- export declare type InitOptions = {
34
- /**
35
- * `fin` API
36
- */
37
- fin: OpenFin.Fin<OpenFin.EntityType>;
38
- /**
39
- * WebRTC peer connection.
40
- */
41
- rtc: RTCPeerConnection;
42
- /**
43
- * Unique identifier for the remote external connection.
44
- */
45
- uuid?: string;
46
- };
47
-
48
- export { }
1
+ import * as OpenFin from 'openfin-adapter/OpenFin';
2
+
3
+ /**
4
+ * Connect remotely to another OpenFin runtime using a WebRTC peer.
5
+ * Returned `fin` will proxy all API calls to the "host" application.
6
+ * If `wait` is `true` than `connect` will resolve once the host application calls `init`.
7
+ * If the host application already called `init` the bridge will be established immediately.
8
+ * @param {ConnectOptions} options connect options
9
+ * @throws If `wait` is `false` and the host application does not call `init` within a timeout
10
+ * @returns {OpenFin.Fin<'external connection'>} `fin` API
11
+ */
12
+ export declare function connect(options: ConnectOptions): Promise<{
13
+ fin: OpenFin.Fin<'external connection'>;
14
+ }>;
15
+
16
+ export declare type ConnectOptions = {
17
+ /**
18
+ * WebRTC peer connection.
19
+ */
20
+ rtc: RTCPeerConnection;
21
+ /**
22
+ * If `connect` should wait for host application to call `init`, defaults to `true`.
23
+ */
24
+ wait?: boolean;
25
+ };
26
+
27
+ /**
28
+ * Initialize a remote connection as a "host" application.
29
+ * @param {InitOptions} options init options
30
+ */
31
+ export declare function init(options: InitOptions): Promise<void>;
32
+
33
+ export declare type InitOptions = {
34
+ /**
35
+ * `fin` API
36
+ */
37
+ fin: OpenFin.Fin<OpenFin.EntityType>;
38
+ /**
39
+ * WebRTC peer connection.
40
+ */
41
+ rtc: RTCPeerConnection;
42
+ /**
43
+ * Unique identifier for the remote external connection.
44
+ */
45
+ uuid?: string;
46
+ };
47
+
48
+ export { }