@telperion/messenger 8.3.1 → 8.4.2
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.
- package/.build-manifest.json +416 -0
- package/README.md +35 -4
- package/broadcast/default-channel-name.cjs +6 -4
- package/broadcast/default-channel-name.cjs.map +1 -0
- package/broadcast/default-channel-name.d.cts +3 -0
- package/broadcast/default-channel-name.d.ts +3 -1
- package/broadcast/default-channel-name.js +2 -1
- package/broadcast/default-channel-name.js.map +1 -1
- package/broadcast/index.cjs +16 -13
- package/broadcast/index.cjs.map +1 -0
- package/broadcast/index.d.cts +11 -0
- package/broadcast/index.d.ts +11 -5
- package/broadcast/index.js +5 -6
- package/broadcast/index.js.map +1 -1
- package/broadcast/message-client.cjs +15 -13
- package/broadcast/message-client.cjs.map +1 -0
- package/broadcast/message-client.d.cts +15 -0
- package/broadcast/message-client.d.ts +9 -6
- package/broadcast/message-client.js +7 -5
- package/broadcast/message-client.js.map +1 -1
- package/broadcast/message-host.cjs +14 -12
- package/broadcast/message-host.cjs.map +1 -0
- package/broadcast/message-host.d.cts +14 -0
- package/broadcast/message-host.d.ts +9 -4
- package/broadcast/message-host.js +7 -5
- package/broadcast/message-host.js.map +1 -1
- package/broadcast/message-service.cjs +11 -9
- package/broadcast/message-service.cjs.map +1 -0
- package/broadcast/message-service.d.cts +15 -0
- package/broadcast/message-service.d.ts +10 -3
- package/broadcast/message-service.js +7 -5
- package/broadcast/message-service.js.map +1 -1
- package/chrome/default-connection-name.cjs +6 -4
- package/chrome/default-connection-name.cjs.map +1 -0
- package/chrome/default-connection-name.d.cts +3 -0
- package/chrome/default-connection-name.d.ts +3 -1
- package/chrome/default-connection-name.js +2 -1
- package/chrome/default-connection-name.js.map +1 -1
- package/chrome/index.cjs +14 -11
- package/chrome/index.cjs.map +1 -0
- package/chrome/index.d.cts +10 -0
- package/chrome/index.d.ts +10 -4
- package/chrome/index.js +4 -5
- package/chrome/index.js.map +1 -1
- package/chrome/message-client.cjs +18 -16
- package/chrome/message-client.cjs.map +1 -0
- package/chrome/message-client.d.cts +17 -0
- package/chrome/message-client.d.ts +8 -6
- package/chrome/message-client.js +6 -4
- package/chrome/message-client.js.map +1 -1
- package/chrome/message-host.cjs +15 -13
- package/chrome/message-host.cjs.map +1 -0
- package/chrome/message-host.d.cts +14 -0
- package/chrome/message-host.d.ts +9 -4
- package/chrome/message-host.js +6 -4
- package/chrome/message-host.js.map +1 -1
- package/fesm/messenger.mjs +114 -0
- package/fesm/messenger.mjs.map +1 -0
- package/iframe/channel-path-splitter.cjs +6 -4
- package/iframe/channel-path-splitter.cjs.map +1 -0
- package/iframe/channel-path-splitter.d.cts +3 -0
- package/iframe/channel-path-splitter.d.ts +3 -1
- package/iframe/channel-path-splitter.js +2 -1
- package/iframe/channel-path-splitter.js.map +1 -1
- package/iframe/default-channel-name.cjs +6 -4
- package/iframe/default-channel-name.cjs.map +1 -0
- package/iframe/default-channel-name.d.cts +3 -0
- package/iframe/default-channel-name.d.ts +3 -1
- package/iframe/default-channel-name.js +2 -1
- package/iframe/default-channel-name.js.map +1 -1
- package/iframe/iframe.type.cjs +3 -2
- package/iframe/iframe.type.cjs.map +1 -0
- package/iframe/iframe.type.d.cts +6 -0
- package/iframe/iframe.type.d.ts +6 -4
- package/iframe/iframe.type.js +0 -1
- package/iframe/iframe.type.js.map +1 -1
- package/iframe/index.cjs +16 -13
- package/iframe/index.cjs.map +1 -0
- package/iframe/index.d.cts +13 -0
- package/iframe/index.d.ts +13 -6
- package/iframe/index.js +5 -6
- package/iframe/index.js.map +1 -1
- package/iframe/message-client.cjs +26 -24
- package/iframe/message-client.cjs.map +1 -0
- package/iframe/message-client.d.cts +19 -0
- package/iframe/message-client.d.ts +9 -7
- package/iframe/message-client.js +7 -5
- package/iframe/message-client.js.map +1 -1
- package/iframe/message-host.cjs +30 -28
- package/iframe/message-host.cjs.map +1 -0
- package/iframe/message-host.d.cts +23 -0
- package/iframe/message-host.d.ts +10 -6
- package/iframe/message-host.js +8 -6
- package/iframe/message-host.js.map +1 -1
- package/iframe/message-service.cjs +13 -11
- package/iframe/message-service.cjs.map +1 -0
- package/iframe/message-service.d.cts +18 -0
- package/iframe/message-service.d.ts +11 -4
- package/iframe/message-service.js +7 -5
- package/iframe/message-service.js.map +1 -1
- package/iframe/source-id-splitter.cjs +6 -4
- package/iframe/source-id-splitter.cjs.map +1 -0
- package/iframe/source-id-splitter.d.cts +3 -0
- package/iframe/source-id-splitter.d.ts +3 -1
- package/iframe/source-id-splitter.js +2 -1
- package/iframe/source-id-splitter.js.map +1 -1
- package/iframe/upcoming-message.cjs +3 -2
- package/iframe/upcoming-message.cjs.map +1 -0
- package/iframe/upcoming-message.d.cts +6 -0
- package/iframe/upcoming-message.d.ts +3 -1
- package/iframe/upcoming-message.js +0 -1
- package/iframe/upcoming-message.js.map +1 -1
- package/index.cjs +22 -13
- package/index.cjs.map +1 -0
- package/index.d.cts +8 -0
- package/index.d.ts +8 -7
- package/index.js +5 -6
- package/index.js.map +1 -1
- package/listen.decorator.cjs +11 -8
- package/listen.decorator.cjs.map +1 -0
- package/listen.decorator.d.cts +8 -0
- package/listen.decorator.d.ts +3 -1
- package/listen.decorator.js +4 -2
- package/listen.decorator.js.map +1 -1
- package/listener-storage.type.cjs +3 -2
- package/listener-storage.type.cjs.map +1 -0
- package/listener-storage.type.d.cts +5 -0
- package/listener-storage.type.d.ts +4 -1
- package/listener-storage.type.js +0 -1
- package/listener-storage.type.js.map +1 -1
- package/message-client.cjs +4 -4
- package/message-client.cjs.map +1 -0
- package/message-client.d.cts +26 -0
- package/message-client.d.ts +8 -5
- package/message-client.js +2 -2
- package/message-client.js.map +1 -1
- package/message-host.cjs +20 -18
- package/message-host.cjs.map +1 -0
- package/message-host.d.cts +29 -0
- package/message-host.d.ts +8 -5
- package/message-host.js +5 -3
- package/message-host.js.map +1 -1
- package/message-response.type.cjs +3 -2
- package/message-response.type.cjs.map +1 -0
- package/message-response.type.d.cts +18 -0
- package/message-response.type.d.ts +8 -6
- package/message-response.type.js +0 -1
- package/message-response.type.js.map +1 -1
- package/message.interface.cjs +3 -2
- package/message.interface.cjs.map +1 -0
- package/message.interface.d.cts +8 -0
- package/message.interface.d.ts +3 -1
- package/message.interface.js +0 -1
- package/message.interface.js.map +1 -1
- package/package.json +387 -75
- package/request.decorator.cjs +16 -9
- package/request.decorator.cjs.map +1 -0
- package/request.decorator.d.cts +3 -0
- package/request.decorator.d.ts +3 -1
- package/request.decorator.js +10 -4
- package/request.decorator.js.map +1 -1
- package/rtc/channel-controller.cjs +13 -7
- package/rtc/channel-controller.cjs.map +1 -0
- package/rtc/channel-controller.d.cts +8 -0
- package/rtc/channel-controller.d.ts +4 -3
- package/rtc/channel-controller.js +9 -4
- package/rtc/channel-controller.js.map +1 -1
- package/rtc/default-channel-name.cjs +6 -4
- package/rtc/default-channel-name.cjs.map +1 -0
- package/rtc/default-channel-name.d.cts +4 -0
- package/rtc/default-channel-name.d.ts +3 -1
- package/rtc/default-channel-name.js +2 -1
- package/rtc/default-channel-name.js.map +1 -1
- package/rtc/index.cjs +16 -13
- package/rtc/index.cjs.map +1 -0
- package/rtc/index.d.cts +12 -0
- package/rtc/index.d.ts +12 -5
- package/rtc/index.js +5 -6
- package/rtc/index.js.map +1 -1
- package/rtc/initializer.cjs +52 -0
- package/rtc/initializer.cjs.map +1 -0
- package/rtc/initializer.d.cts +20 -0
- package/rtc/initializer.d.ts +20 -0
- package/rtc/initializer.js +50 -0
- package/rtc/initializer.js.map +1 -0
- package/rtc/message-client.cjs +97 -72
- package/rtc/message-client.cjs.map +1 -0
- package/rtc/message-client.d.cts +75 -0
- package/rtc/message-client.d.ts +42 -19
- package/rtc/message-client.js +82 -59
- package/rtc/message-client.js.map +1 -1
- package/rtc/message-host.cjs +77 -70
- package/rtc/message-host.cjs.map +1 -0
- package/rtc/message-host.d.cts +70 -0
- package/rtc/message-host.d.ts +37 -17
- package/rtc/message-host.js +64 -59
- package/rtc/message-host.js.map +1 -1
- package/rtc/message-service.cjs +28 -16
- package/rtc/message-service.cjs.map +1 -0
- package/rtc/message-service.d.cts +46 -0
- package/rtc/message-service.d.ts +18 -9
- package/rtc/message-service.js +25 -13
- package/rtc/message-service.js.map +1 -1
- package/rtc/rtc.type.cjs +3 -2
- package/rtc/rtc.type.cjs.map +1 -0
- package/rtc/rtc.type.d.cts +14 -0
- package/rtc/rtc.type.d.ts +6 -4
- package/rtc/rtc.type.js +0 -1
- package/rtc/rtc.type.js.map +1 -1
- package/selectors.cjs +18 -10
- package/selectors.cjs.map +1 -0
- package/selectors.d.cts +9 -0
- package/selectors.d.ts +9 -7
- package/selectors.js +8 -7
- package/selectors.js.map +1 -1
- package/worker/index.cjs +16 -13
- package/worker/index.cjs.map +1 -0
- package/worker/index.d.cts +12 -0
- package/worker/index.d.ts +12 -5
- package/worker/index.js +5 -6
- package/worker/index.js.map +1 -1
- package/worker/initializer.cjs +11 -8
- package/worker/initializer.cjs.map +1 -0
- package/worker/initializer.d.cts +15 -0
- package/worker/initializer.d.ts +8 -5
- package/worker/initializer.js +5 -3
- package/worker/initializer.js.map +1 -1
- package/worker/message-client.cjs +19 -17
- package/worker/message-client.cjs.map +1 -0
- package/worker/message-client.d.cts +133 -0
- package/worker/message-client.d.ts +10 -8
- package/worker/message-client.js +9 -7
- package/worker/message-client.js.map +1 -1
- package/worker/message-host.cjs +17 -15
- package/worker/message-host.cjs.map +1 -0
- package/worker/message-host.d.cts +135 -0
- package/worker/message-host.d.ts +10 -6
- package/worker/message-host.js +8 -6
- package/worker/message-host.js.map +1 -1
- package/worker/message-service.cjs +11 -9
- package/worker/message-service.cjs.map +1 -0
- package/worker/message-service.d.cts +124 -0
- package/worker/message-service.d.ts +11 -4
- package/worker/message-service.js +6 -4
- package/worker/message-service.js.map +1 -1
package/rtc/message-host.d.ts
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import { MessageHost } from '../message-host';
|
|
2
|
-
import { MessageResponse } from '../message-response.type';
|
|
3
|
-
import { RESPONSE } from '../selectors';
|
|
4
|
-
import { RTCConnectionArg } from './rtc.type';
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { MessageHost } from '../message-host.js';
|
|
2
|
+
import { MessageResponse } from '../message-response.type.js';
|
|
3
|
+
import { RESPONSE } from '../selectors.js';
|
|
4
|
+
import { RTCConnectionArg } from './rtc.type.js';
|
|
5
|
+
import 'rxjs';
|
|
6
|
+
import '../message.interface.js';
|
|
7
|
+
|
|
7
8
|
declare const CHANNEL_NAME: unique symbol;
|
|
8
|
-
|
|
9
|
+
declare const CHANNEL: unique symbol;
|
|
10
|
+
declare const CHANNEL_OPEN: unique symbol;
|
|
11
|
+
declare const DEINITIALIZE: unique symbol;
|
|
12
|
+
declare const REQUESTS: unique symbol;
|
|
13
|
+
declare const READY: unique symbol;
|
|
14
|
+
declare const CREATED: unique symbol;
|
|
9
15
|
/**
|
|
10
|
-
*
|
|
16
|
+
* WebRTC DataChannel message host that listens for incoming request messages
|
|
17
|
+
* and dispatches responses over the same negotiated channel.
|
|
18
|
+
*
|
|
19
|
+
* Both peers must create the channel with an identical name and negotiated ID.
|
|
20
|
+
* The ID is derived automatically from the channel name via an FNV-1a hash
|
|
21
|
+
* unless an explicit `channelId` is supplied.
|
|
11
22
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
23
|
+
* Use `@Listen` decorators to register request handlers. The host begins
|
|
24
|
+
* listening as soon as it is constructed; pass a connection later via
|
|
25
|
+
* {@link initialize} if one is not available at construction time.
|
|
15
26
|
*
|
|
16
27
|
* @example
|
|
17
28
|
* ```typescript
|
|
@@ -25,26 +36,35 @@ export declare const READY: unique symbol;
|
|
|
25
36
|
* const host = new GameHost(peerConnection, 'game-events');
|
|
26
37
|
* ```
|
|
27
38
|
*/
|
|
28
|
-
|
|
39
|
+
declare class RTCMessageHost extends MessageHost {
|
|
29
40
|
private [REQUESTS];
|
|
30
|
-
private [CONNECTION];
|
|
31
41
|
private [CHANNEL_NAME];
|
|
42
|
+
private [CHANNEL];
|
|
43
|
+
private [CHANNEL_OPEN];
|
|
44
|
+
private [DEINITIALIZE];
|
|
45
|
+
private get [CREATED]();
|
|
46
|
+
/** Resolves with the `RTCDataChannel` once it has been created (may not yet be open). */
|
|
47
|
+
get created(): Promise<RTCDataChannel>;
|
|
32
48
|
private get [READY]();
|
|
49
|
+
/** Resolves with the `RTCDataChannel` once it is open and ready to transmit. */
|
|
33
50
|
get ready(): Promise<RTCDataChannel>;
|
|
34
51
|
/**
|
|
35
|
-
* @param connection
|
|
52
|
+
* @param connection - RTCPeerConnection instance, promise, or factory function. Omit to initialize later via {@link initialize}.
|
|
36
53
|
* @param channelName - Name for the negotiated data channel. Determines the channel ID via FNV-1a hash.
|
|
54
|
+
* @param channelId - Explicit negotiated channel ID. Overrides the hash-derived default.
|
|
37
55
|
*/
|
|
38
|
-
constructor(connection?: RTCConnectionArg, channelName?: string);
|
|
56
|
+
constructor(connection?: RTCConnectionArg, channelName?: string, channelId?: number);
|
|
39
57
|
/**
|
|
40
58
|
* (Re)initializes the data channel with a new connection.
|
|
41
59
|
* Cleans up the previous channel before establishing a new one.
|
|
42
60
|
*
|
|
43
61
|
* @param connection - RTCPeerConnection instance, promise, or factory function.
|
|
62
|
+
* @param channelId - Optional new channel ID. Defaults to the current channel ID.
|
|
44
63
|
*/
|
|
45
|
-
initialize(connection
|
|
64
|
+
initialize(connection?: RTCConnectionArg, channelId?: number): void;
|
|
46
65
|
/** Closes the data channel and removes event listeners. */
|
|
47
66
|
terminate(): void;
|
|
48
67
|
protected [RESPONSE](message: MessageResponse): Promise<void>;
|
|
49
68
|
}
|
|
50
|
-
|
|
69
|
+
|
|
70
|
+
export { CREATED, READY, RTCMessageHost };
|
package/rtc/message-host.js
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { noop } from '@telperion/js-utils/function/noop';
|
|
2
|
-
import {
|
|
3
|
-
import { timeout } from '@telperion/js-utils/promise/timeout';
|
|
2
|
+
import { call } from '@telperion/js-utils/function/call';
|
|
4
3
|
import { NEVER } from '@telperion/js-utils/promise/never';
|
|
5
4
|
import { Subject } from 'rxjs';
|
|
6
|
-
import { MessageHost } from '../message-host';
|
|
7
|
-
import { LISTEN, RESPONSE } from '../selectors';
|
|
8
|
-
import { DEFAULT_CHANNEL_NAME } from './default-channel-name';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const REQUESTS = Symbol('RTCMessageHost Requests');
|
|
5
|
+
import { MessageHost } from '../message-host.js';
|
|
6
|
+
import { LISTEN, RESPONSE } from '../selectors.js';
|
|
7
|
+
import { DEFAULT_CHANNEL_NAME } from './default-channel-name.js';
|
|
8
|
+
import { initialize } from './initializer.js';
|
|
9
|
+
|
|
12
10
|
const CHANNEL_NAME = Symbol('RTCMessageHost Channel Name');
|
|
13
|
-
|
|
11
|
+
const CHANNEL = Symbol('RTCMessageHost Channel');
|
|
12
|
+
const CHANNEL_OPEN = Symbol('RTCMessageHost Channel Open');
|
|
13
|
+
const DEINITIALIZE = Symbol('RTCMessageHost Deinitialize');
|
|
14
|
+
const REQUESTS = Symbol('RTCMessageHost Requests');
|
|
15
|
+
const READY = Symbol('RTCMessageHost Ready');
|
|
16
|
+
const CREATED = Symbol('RTCMessageHost Created');
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
18
|
+
* WebRTC DataChannel message host that listens for incoming request messages
|
|
19
|
+
* and dispatches responses over the same negotiated channel.
|
|
16
20
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
21
|
+
* Both peers must create the channel with an identical name and negotiated ID.
|
|
22
|
+
* The ID is derived automatically from the channel name via an FNV-1a hash
|
|
23
|
+
* unless an explicit `channelId` is supplied.
|
|
24
|
+
*
|
|
25
|
+
* Use `@Listen` decorators to register request handlers. The host begins
|
|
26
|
+
* listening as soon as it is constructed; pass a connection later via
|
|
27
|
+
* {@link initialize} if one is not available at construction time.
|
|
20
28
|
*
|
|
21
29
|
* @example
|
|
22
30
|
* ```typescript
|
|
@@ -30,24 +38,35 @@ export const READY = Symbol('RTCMessageHost Ready');
|
|
|
30
38
|
* const host = new GameHost(peerConnection, 'game-events');
|
|
31
39
|
* ```
|
|
32
40
|
*/
|
|
33
|
-
|
|
41
|
+
class RTCMessageHost extends MessageHost {
|
|
34
42
|
[REQUESTS] = new Subject();
|
|
35
|
-
[CONNECTION] = Promise.resolve([undefined, noop]);
|
|
36
43
|
[CHANNEL_NAME];
|
|
44
|
+
[CHANNEL] = NEVER;
|
|
45
|
+
[CHANNEL_OPEN] = NEVER;
|
|
46
|
+
[DEINITIALIZE] = Promise.resolve(noop);
|
|
47
|
+
get [CREATED]() {
|
|
48
|
+
return this[CHANNEL];
|
|
49
|
+
}
|
|
50
|
+
/** Resolves with the `RTCDataChannel` once it has been created (may not yet be open). */
|
|
51
|
+
get created() {
|
|
52
|
+
return this[CREATED];
|
|
53
|
+
}
|
|
37
54
|
get [READY]() {
|
|
38
|
-
return this[
|
|
55
|
+
return this[CHANNEL_OPEN];
|
|
39
56
|
}
|
|
57
|
+
/** Resolves with the `RTCDataChannel` once it is open and ready to transmit. */
|
|
40
58
|
get ready() {
|
|
41
59
|
return this[READY];
|
|
42
60
|
}
|
|
43
61
|
/**
|
|
44
|
-
* @param connection
|
|
62
|
+
* @param connection - RTCPeerConnection instance, promise, or factory function. Omit to initialize later via {@link initialize}.
|
|
45
63
|
* @param channelName - Name for the negotiated data channel. Determines the channel ID via FNV-1a hash.
|
|
64
|
+
* @param channelId - Explicit negotiated channel ID. Overrides the hash-derived default.
|
|
46
65
|
*/
|
|
47
|
-
constructor(connection, channelName = DEFAULT_CHANNEL_NAME) {
|
|
66
|
+
constructor(connection, channelName = DEFAULT_CHANNEL_NAME, channelId) {
|
|
48
67
|
super();
|
|
49
68
|
this[CHANNEL_NAME] = channelName;
|
|
50
|
-
RTCMessageHost.prototype.initialize.call(this, connection);
|
|
69
|
+
RTCMessageHost.prototype.initialize.call(this, connection, channelId);
|
|
51
70
|
this[LISTEN](this[REQUESTS]);
|
|
52
71
|
}
|
|
53
72
|
/**
|
|
@@ -55,54 +74,40 @@ export class RTCMessageHost extends MessageHost {
|
|
|
55
74
|
* Cleans up the previous channel before establishing a new one.
|
|
56
75
|
*
|
|
57
76
|
* @param connection - RTCPeerConnection instance, promise, or factory function.
|
|
77
|
+
* @param channelId - Optional new channel ID. Defaults to the current channel ID.
|
|
58
78
|
*/
|
|
59
|
-
initialize(connection) {
|
|
60
|
-
|
|
61
|
-
this
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return;
|
|
73
|
-
const dataChannel = CHANNEL_CONTROLLER.getChannel(conn, this[CHANNEL_NAME]);
|
|
74
|
-
if (dataChannel.readyState === 'open')
|
|
75
|
-
return dataChannel;
|
|
76
|
-
return new Promise((resolve) => {
|
|
77
|
-
dataChannel.addEventListener('open', () => resolve(dataChannel), { once: true });
|
|
78
|
-
});
|
|
79
|
-
})
|
|
80
|
-
.then(dataChannel => {
|
|
81
|
-
if (!dataChannel)
|
|
82
|
-
return [undefined, noop];
|
|
83
|
-
const handler = (event) => {
|
|
84
|
-
const data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
|
|
85
|
-
if (data.type !== 'request')
|
|
86
|
-
return;
|
|
87
|
-
this[REQUESTS].next(data);
|
|
88
|
-
};
|
|
89
|
-
dataChannel.addEventListener('message', handler);
|
|
90
|
-
return [dataChannel, () => {
|
|
91
|
-
dataChannel.removeEventListener('message', handler);
|
|
92
|
-
CHANNEL_CONTROLLER.close(dataChannel);
|
|
93
|
-
}];
|
|
79
|
+
initialize(connection, channelId) {
|
|
80
|
+
initialize({
|
|
81
|
+
context: this,
|
|
82
|
+
selectors: {
|
|
83
|
+
channel: CHANNEL,
|
|
84
|
+
channelOpen: CHANNEL_OPEN,
|
|
85
|
+
deinit: DEINITIALIZE,
|
|
86
|
+
emitter: REQUESTS
|
|
87
|
+
},
|
|
88
|
+
connection,
|
|
89
|
+
channelName: this[CHANNEL_NAME],
|
|
90
|
+
channelId,
|
|
91
|
+
messageFilterType: 'request'
|
|
94
92
|
});
|
|
95
93
|
}
|
|
96
94
|
/** Closes the data channel and removes event listeners. */
|
|
97
95
|
terminate() {
|
|
98
|
-
this[
|
|
99
|
-
.then(([_, deinitialize]) => deinitialize())
|
|
100
|
-
.catch(noop);
|
|
96
|
+
this[DEINITIALIZE].then(call);
|
|
101
97
|
}
|
|
102
98
|
async [RESPONSE](message) {
|
|
103
|
-
const
|
|
104
|
-
|
|
99
|
+
const dataChannel = await this[CHANNEL_OPEN];
|
|
100
|
+
// If the channel closed, the requester is gone, so the response is dropped.
|
|
101
|
+
if (dataChannel.readyState !== 'open')
|
|
102
|
+
return;
|
|
103
|
+
try {
|
|
104
|
+
dataChannel.send(JSON.stringify({ ...message, type: 'response' }));
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// The channel closed while sending. The requester is gone, so drop it.
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
|
|
112
|
+
export { CREATED, READY, RTCMessageHost };
|
|
108
113
|
//# sourceMappingURL=message-host.js.map
|
package/rtc/message-host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"file":"message-host.js","sources":["../../../../libs/messenger/src/rtc/message-host.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAaA,MAAM,YAAY,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC1D,MAAM,OAAO,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAChD,MAAM,YAAY,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC1D,MAAM,YAAY,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC1D,MAAM,QAAQ,GAAG,MAAM,CAAC,yBAAyB,CAAC;MACrC,KAAK,GAAG,MAAM,CAAC,sBAAsB;MACrC,OAAO,GAAG,MAAM,CAAC,wBAAwB;AAEtD;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AACG,MAAO,cAAe,SAAQ,WAAW,CAAA;AACrC,IAAA,CAAC,QAAQ,IAAI,IAAI,OAAO,EAAW;IACnC,CAAC,YAAY;AACb,IAAA,CAAC,OAAO,IAA6B,KAAK;AAC1C,IAAA,CAAC,YAAY,IAA6B,KAAK;IAC/C,CAAC,YAAY,IAAyB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;IAEnE,KAAa,OAAO,CAAC,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB;;AAGA,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB;IAEA,KAAa,KAAK,CAAC,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B;;AAGA,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB;AAEA;;;;AAIG;AACH,IAAA,WAAA,CACE,UAA6B,EAC7B,WAAW,GAAG,oBAAoB,EAClC,SAAkB,EAAA;AAElB,QAAA,KAAK,EAAE;AAEP,QAAA,IAAI,CAAC,YAAY,CAAC,GAAG,WAAW;AAChC,QAAA,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9B;AAEA;;;;;;AAMG;IACH,UAAU,CAAC,UAA6B,EAAE,SAAkB,EAAA;AAC1D,QAAA,UAAU,CAAC;AACT,YAAA,OAAO,EAAE,IAAI;AACb,YAAA,SAAS,EAAE;AACT,gBAAA,OAAO,EAAE,OAAO;AAChB,gBAAA,WAAW,EAAE,YAAY;AACzB,gBAAA,MAAM,EAAE,YAAY;AACpB,gBAAA,OAAO,EAAE;AACV,aAAA;YACD,UAAU;AACV,YAAA,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC;YAC/B,SAAS;AACT,YAAA,iBAAiB,EAAE;AACpB,SAAA,CAAC;IACJ;;IAGO,SAAS,GAAA;QACd,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAC/B;AAEU,IAAA,OAAO,QAAQ,CAAC,CAAC,OAAwB,EAAA;AACjD,QAAA,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC;;AAG5C,QAAA,IAAI,WAAW,CAAC,UAAU,KAAK,MAAM;YAAE;AAEvC,QAAA,IAAI;AACF,YAAA,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACnE;AAAE,QAAA,MAAM;;QAER;IACF;AACD;;;;"}
|
package/rtc/message-service.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var mixin = require('@telperion/js-utils/class/mixin');
|
|
4
|
+
var rtc_messageClient = require('./message-client.cjs');
|
|
5
|
+
var rtc_messageHost = require('./message-host.cjs');
|
|
6
|
+
var rtc_defaultChannelName = require('./default-channel-name.cjs');
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* Bidirectional message service for WebRTC DataChannel communication.
|
|
10
10
|
*
|
|
@@ -26,26 +26,38 @@ const default_channel_name_1 = require("./default-channel-name");
|
|
|
26
26
|
* const peer = new GamePeer(peerConnection, 'game-events');
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
class RTCMessageService extends
|
|
29
|
+
class RTCMessageService extends mixin.mixin(rtc_messageHost.RTCMessageHost, rtc_messageClient.RTCMessageClient) {
|
|
30
30
|
/**
|
|
31
|
-
* @param connection
|
|
31
|
+
* @param connection - RTCPeerConnection instance, promise, or factory function.
|
|
32
32
|
* @param channelName - Name for the negotiated data channel.
|
|
33
|
+
* @param channelId - Explicit negotiated channel ID. Overrides the hash-derived default.
|
|
33
34
|
*/
|
|
34
|
-
constructor(connection, channelName =
|
|
35
|
-
super([connection, channelName], [connection, channelName]);
|
|
35
|
+
constructor(connection, channelName = rtc_defaultChannelName.DEFAULT_CHANNEL_NAME, channelId) {
|
|
36
|
+
super([connection, channelName, channelId], [connection, channelName, channelId]);
|
|
36
37
|
Reflect.defineProperty(this, 'ready', {
|
|
37
38
|
get: () => {
|
|
38
39
|
return Promise.race([
|
|
39
|
-
this[
|
|
40
|
-
this[
|
|
40
|
+
this[rtc_messageClient.READY],
|
|
41
|
+
this[rtc_messageHost.READY]
|
|
42
|
+
]);
|
|
43
|
+
},
|
|
44
|
+
configurable: false
|
|
45
|
+
});
|
|
46
|
+
Reflect.defineProperty(this, 'created', {
|
|
47
|
+
get: () => {
|
|
48
|
+
return Promise.race([
|
|
49
|
+
this[rtc_messageClient.CREATED],
|
|
50
|
+
this[rtc_messageHost.CREATED]
|
|
41
51
|
]);
|
|
42
52
|
},
|
|
43
53
|
configurable: false
|
|
44
54
|
});
|
|
45
55
|
}
|
|
46
|
-
initialize = (connection) => {
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
initialize = (connection, channelId) => {
|
|
57
|
+
rtc_messageHost.RTCMessageHost.prototype.initialize.call(this, connection, channelId);
|
|
58
|
+
rtc_messageClient.RTCMessageClient.prototype.initialize.call(this, connection, channelId);
|
|
49
59
|
};
|
|
50
60
|
}
|
|
61
|
+
|
|
51
62
|
exports.RTCMessageService = RTCMessageService;
|
|
63
|
+
//# sourceMappingURL=message-service.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-service.cjs","sources":["../../../../libs/messenger/src/rtc/message-service.ts"],"sourcesContent":[null],"names":["mixin","RTCMessageHost","RTCMessageClient","DEFAULT_CHANNEL_NAME","CLIENT_READY","HOST_READY","CLIENT_CREATED","HOST_CREATED"],"mappings":";;;;;;;AAOA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,MAAO,iBAAkB,SAAQA,WAAK,CAACC,8BAAc,EAAEC,kCAAgB,CAAC,CAAA;AAC5E;;;;AAIG;AACH,IAAA,WAAA,CAAY,UAA6B,EAAE,WAAW,GAAGC,2CAAoB,EAAE,SAAkB,EAAA;AAC/F,QAAA,KAAK,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAEjF,QAAA,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE;YACpC,GAAG,EAAE,MAAK;gBACR,OAAO,OAAO,CAAC,IAAI,CAAC;oBAClB,IAAI,CAACC,uBAAY,CAAC;oBACjB,IAAY,CAACC,qBAAU;AACzB,iBAAA,CAAC;YACJ,CAAC;AACD,YAAA,YAAY,EAAE;AACf,SAAA,CAAC;AAEF,QAAA,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE;YACtC,GAAG,EAAE,MAAK;gBACR,OAAO,OAAO,CAAC,IAAI,CAAC;oBAClB,IAAI,CAACC,yBAAc,CAAC;oBACnB,IAAY,CAACC,uBAAY;AAC3B,iBAAA,CAAC;YACJ,CAAC;AACD,YAAA,YAAY,EAAE;AACf,SAAA,CAAC;IACJ;AAEgB,IAAA,UAAU,GAAG,CAAC,UAA4B,EAAE,SAAkB,KAAU;AACtF,QAAAN,8BAAc,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;AACrE,QAAAC,kCAAgB,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;AACzE,IAAA,CAAC;AACF;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RTCMessageClient } from './message-client.cjs';
|
|
2
|
+
import { RTCConnectionArg } from './rtc.type.cjs';
|
|
3
|
+
import 'rxjs';
|
|
4
|
+
import '../message-client.cjs';
|
|
5
|
+
import '../message-response.type.cjs';
|
|
6
|
+
import '../message.interface.cjs';
|
|
7
|
+
import '../selectors.cjs';
|
|
8
|
+
|
|
9
|
+
declare const RTCMessageService_base: new (args_0: [connection?: RTCConnectionArg, channelName?: string | undefined, channelId?: number | undefined], args_1: [connection?: RTCConnectionArg, channelName?: string | undefined, channelId?: number | undefined]) => {
|
|
10
|
+
readonly created: Promise<RTCDataChannel>;
|
|
11
|
+
readonly ready: Promise<RTCDataChannel>;
|
|
12
|
+
initialize: (connection?: RTCConnectionArg, channelId?: number) => void;
|
|
13
|
+
terminate: () => void;
|
|
14
|
+
} & RTCMessageClient;
|
|
15
|
+
/**
|
|
16
|
+
* Bidirectional message service for WebRTC DataChannel communication.
|
|
17
|
+
*
|
|
18
|
+
* Combines {@link RTCMessageHost} and {@link RTCMessageClient} via mixin,
|
|
19
|
+
* enabling both `@Listen` and `@Request` decorators on the same class.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* class GamePeer extends RTCMessageService {
|
|
24
|
+
* @Request('move')
|
|
25
|
+
* sendMove(pos: [number, number]): Observable<boolean> { return null!; }
|
|
26
|
+
*
|
|
27
|
+
* @Listen('move')
|
|
28
|
+
* handleMove({ data }: { data: [number, number] }): Observable<boolean> {
|
|
29
|
+
* return of(applyMove(data));
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* const peer = new GamePeer(peerConnection, 'game-events');
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare class RTCMessageService extends RTCMessageService_base {
|
|
37
|
+
/**
|
|
38
|
+
* @param connection - RTCPeerConnection instance, promise, or factory function.
|
|
39
|
+
* @param channelName - Name for the negotiated data channel.
|
|
40
|
+
* @param channelId - Explicit negotiated channel ID. Overrides the hash-derived default.
|
|
41
|
+
*/
|
|
42
|
+
constructor(connection?: RTCConnectionArg, channelName?: string, channelId?: number);
|
|
43
|
+
initialize: (connection: RTCConnectionArg, channelId?: number) => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { RTCMessageService };
|
package/rtc/message-service.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { RTCMessageClient } from
|
|
2
|
-
import { RTCConnectionArg } from
|
|
3
|
-
|
|
1
|
+
import { RTCMessageClient } from './message-client.js';
|
|
2
|
+
import { RTCConnectionArg } from './rtc.type.js';
|
|
3
|
+
import 'rxjs';
|
|
4
|
+
import '../message-client.js';
|
|
5
|
+
import '../message-response.type.js';
|
|
6
|
+
import '../message.interface.js';
|
|
7
|
+
import '../selectors.js';
|
|
8
|
+
|
|
9
|
+
declare const RTCMessageService_base: new (args_0: [connection?: RTCConnectionArg, channelName?: string | undefined, channelId?: number | undefined], args_1: [connection?: RTCConnectionArg, channelName?: string | undefined, channelId?: number | undefined]) => {
|
|
10
|
+
readonly created: Promise<RTCDataChannel>;
|
|
4
11
|
readonly ready: Promise<RTCDataChannel>;
|
|
5
|
-
initialize: (connection?: RTCConnectionArg) => void;
|
|
12
|
+
initialize: (connection?: RTCConnectionArg, channelId?: number) => void;
|
|
6
13
|
terminate: () => void;
|
|
7
14
|
} & RTCMessageClient;
|
|
8
15
|
/**
|
|
@@ -26,12 +33,14 @@ declare const RTCMessageService_base: new (args_0: [connection?: RTCConnectionAr
|
|
|
26
33
|
* const peer = new GamePeer(peerConnection, 'game-events');
|
|
27
34
|
* ```
|
|
28
35
|
*/
|
|
29
|
-
|
|
36
|
+
declare class RTCMessageService extends RTCMessageService_base {
|
|
30
37
|
/**
|
|
31
|
-
* @param connection
|
|
38
|
+
* @param connection - RTCPeerConnection instance, promise, or factory function.
|
|
32
39
|
* @param channelName - Name for the negotiated data channel.
|
|
40
|
+
* @param channelId - Explicit negotiated channel ID. Overrides the hash-derived default.
|
|
33
41
|
*/
|
|
34
|
-
constructor(connection?: RTCConnectionArg, channelName?: string);
|
|
35
|
-
initialize: (connection: RTCConnectionArg) => void;
|
|
42
|
+
constructor(connection?: RTCConnectionArg, channelName?: string, channelId?: number);
|
|
43
|
+
initialize: (connection: RTCConnectionArg, channelId?: number) => void;
|
|
36
44
|
}
|
|
37
|
-
|
|
45
|
+
|
|
46
|
+
export { RTCMessageService };
|
package/rtc/message-service.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { mixin } from
|
|
2
|
-
import { READY
|
|
3
|
-
import { READY as
|
|
4
|
-
import { DEFAULT_CHANNEL_NAME } from
|
|
1
|
+
import { mixin } from '@telperion/js-utils/class/mixin';
|
|
2
|
+
import { RTCMessageClient, READY, CREATED } from './message-client.js';
|
|
3
|
+
import { RTCMessageHost, READY as READY$1, CREATED as CREATED$1 } from './message-host.js';
|
|
4
|
+
import { DEFAULT_CHANNEL_NAME } from './default-channel-name.js';
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* Bidirectional message service for WebRTC DataChannel communication.
|
|
7
8
|
*
|
|
@@ -23,27 +24,38 @@ import { DEFAULT_CHANNEL_NAME } from "./default-channel-name";
|
|
|
23
24
|
* const peer = new GamePeer(peerConnection, 'game-events');
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
class RTCMessageService extends mixin(RTCMessageHost, RTCMessageClient) {
|
|
27
28
|
/**
|
|
28
|
-
* @param connection
|
|
29
|
+
* @param connection - RTCPeerConnection instance, promise, or factory function.
|
|
29
30
|
* @param channelName - Name for the negotiated data channel.
|
|
31
|
+
* @param channelId - Explicit negotiated channel ID. Overrides the hash-derived default.
|
|
30
32
|
*/
|
|
31
|
-
constructor(connection, channelName = DEFAULT_CHANNEL_NAME) {
|
|
32
|
-
super([connection, channelName], [connection, channelName]);
|
|
33
|
+
constructor(connection, channelName = DEFAULT_CHANNEL_NAME, channelId) {
|
|
34
|
+
super([connection, channelName, channelId], [connection, channelName, channelId]);
|
|
33
35
|
Reflect.defineProperty(this, 'ready', {
|
|
34
36
|
get: () => {
|
|
35
37
|
return Promise.race([
|
|
36
|
-
this[
|
|
37
|
-
this[
|
|
38
|
+
this[READY],
|
|
39
|
+
this[READY$1]
|
|
40
|
+
]);
|
|
41
|
+
},
|
|
42
|
+
configurable: false
|
|
43
|
+
});
|
|
44
|
+
Reflect.defineProperty(this, 'created', {
|
|
45
|
+
get: () => {
|
|
46
|
+
return Promise.race([
|
|
47
|
+
this[CREATED],
|
|
48
|
+
this[CREATED$1]
|
|
38
49
|
]);
|
|
39
50
|
},
|
|
40
51
|
configurable: false
|
|
41
52
|
});
|
|
42
53
|
}
|
|
43
|
-
initialize = (connection) => {
|
|
44
|
-
RTCMessageHost.prototype.initialize.call(this, connection);
|
|
45
|
-
RTCMessageClient.prototype.initialize.call(this, connection);
|
|
54
|
+
initialize = (connection, channelId) => {
|
|
55
|
+
RTCMessageHost.prototype.initialize.call(this, connection, channelId);
|
|
56
|
+
RTCMessageClient.prototype.initialize.call(this, connection, channelId);
|
|
46
57
|
};
|
|
47
58
|
}
|
|
48
59
|
|
|
60
|
+
export { RTCMessageService };
|
|
49
61
|
//# sourceMappingURL=message-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"file":"message-service.js","sources":["../../../../libs/messenger/src/rtc/message-service.ts"],"sourcesContent":[null],"names":["CLIENT_READY","HOST_READY","CLIENT_CREATED","HOST_CREATED"],"mappings":";;;;;AAOA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,MAAO,iBAAkB,SAAQ,KAAK,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAA;AAC5E;;;;AAIG;AACH,IAAA,WAAA,CAAY,UAA6B,EAAE,WAAW,GAAG,oBAAoB,EAAE,SAAkB,EAAA;AAC/F,QAAA,KAAK,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAEjF,QAAA,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE;YACpC,GAAG,EAAE,MAAK;gBACR,OAAO,OAAO,CAAC,IAAI,CAAC;oBAClB,IAAI,CAACA,KAAY,CAAC;oBACjB,IAAY,CAACC,OAAU;AACzB,iBAAA,CAAC;YACJ,CAAC;AACD,YAAA,YAAY,EAAE;AACf,SAAA,CAAC;AAEF,QAAA,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE;YACtC,GAAG,EAAE,MAAK;gBACR,OAAO,OAAO,CAAC,IAAI,CAAC;oBAClB,IAAI,CAACC,OAAc,CAAC;oBACnB,IAAY,CAACC,SAAY;AAC3B,iBAAA,CAAC;YACJ,CAAC;AACD,YAAA,YAAY,EAAE;AACf,SAAA,CAAC;IACJ;AAEgB,IAAA,UAAU,GAAG,CAAC,UAA4B,EAAE,SAAkB,KAAU;AACtF,QAAA,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;AACrE,QAAA,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;AACzE,IAAA,CAAC;AACF;;;;"}
|
package/rtc/rtc.type.cjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=rtc.type.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rtc.type.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** An RTCPeerConnection instance or `undefined` if not yet available. */
|
|
2
|
+
type RTCConnectionType = RTCPeerConnection | undefined;
|
|
3
|
+
/** A promise that resolves to an RTCPeerConnection (or `undefined`). */
|
|
4
|
+
type RTCConnectionPromise = Promise<RTCConnectionType>;
|
|
5
|
+
/** A factory function that returns an RTCPeerConnection synchronously or asynchronously. */
|
|
6
|
+
type RTCConnectionFactory = () => RTCConnectionType | RTCConnectionPromise;
|
|
7
|
+
/**
|
|
8
|
+
* Flexible connection argument accepted by RTC message classes.
|
|
9
|
+
*
|
|
10
|
+
* Supports direct instances, promises, and factory functions for lazy or async initialization.
|
|
11
|
+
*/
|
|
12
|
+
type RTCConnectionArg = RTCConnectionType | RTCConnectionPromise | RTCConnectionFactory;
|
|
13
|
+
|
|
14
|
+
export type { RTCConnectionArg, RTCConnectionFactory, RTCConnectionPromise, RTCConnectionType };
|
package/rtc/rtc.type.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/** An RTCPeerConnection instance or `undefined` if not yet available. */
|
|
2
|
-
|
|
2
|
+
type RTCConnectionType = RTCPeerConnection | undefined;
|
|
3
3
|
/** A promise that resolves to an RTCPeerConnection (or `undefined`). */
|
|
4
|
-
|
|
4
|
+
type RTCConnectionPromise = Promise<RTCConnectionType>;
|
|
5
5
|
/** A factory function that returns an RTCPeerConnection synchronously or asynchronously. */
|
|
6
|
-
|
|
6
|
+
type RTCConnectionFactory = () => RTCConnectionType | RTCConnectionPromise;
|
|
7
7
|
/**
|
|
8
8
|
* Flexible connection argument accepted by RTC message classes.
|
|
9
9
|
*
|
|
10
10
|
* Supports direct instances, promises, and factory functions for lazy or async initialization.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
type RTCConnectionArg = RTCConnectionType | RTCConnectionPromise | RTCConnectionFactory;
|
|
13
|
+
|
|
14
|
+
export type { RTCConnectionArg, RTCConnectionFactory, RTCConnectionPromise, RTCConnectionType };
|
package/rtc/rtc.type.js
CHANGED
package/rtc/rtc.type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"rtc.type.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/selectors.cjs
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const MESSAGE_LISTENERS = Symbol('Message Listeners');
|
|
4
|
+
const RESPONSES$ = Symbol('Responses');
|
|
5
|
+
const SEND = Symbol('Send');
|
|
6
|
+
const GET_NEW_ID = Symbol('Get New Id');
|
|
7
|
+
const LISTEN = Symbol('Listen');
|
|
8
|
+
const TERMINATE_MESSAGE$ = Symbol('Terminate Message');
|
|
9
|
+
const RESPONSE = Symbol('Response');
|
|
10
|
+
|
|
11
|
+
exports.GET_NEW_ID = GET_NEW_ID;
|
|
12
|
+
exports.LISTEN = LISTEN;
|
|
13
|
+
exports.MESSAGE_LISTENERS = MESSAGE_LISTENERS;
|
|
14
|
+
exports.RESPONSE = RESPONSE;
|
|
15
|
+
exports.RESPONSES$ = RESPONSES$;
|
|
16
|
+
exports.SEND = SEND;
|
|
17
|
+
exports.TERMINATE_MESSAGE$ = TERMINATE_MESSAGE$;
|
|
18
|
+
//# sourceMappingURL=selectors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.cjs","sources":["../../../libs/messenger/src/selectors.ts"],"sourcesContent":[null],"names":[],"mappings":";;MAAa,iBAAiB,GAAG,MAAM,CAAC,mBAAmB;MAC9C,UAAU,GAAG,MAAM,CAAC,WAAW;MAC/B,IAAI,GAAG,MAAM,CAAC,MAAM;MACpB,UAAU,GAAG,MAAM,CAAC,YAAY;MAChC,MAAM,GAAG,MAAM,CAAC,QAAQ;MACxB,kBAAkB,GAAG,MAAM,CAAC,mBAAmB;MAC/C,QAAQ,GAAG,MAAM,CAAC,UAAU;;;;;;;;;;"}
|
package/selectors.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const MESSAGE_LISTENERS: unique symbol;
|
|
2
|
+
declare const RESPONSES$: unique symbol;
|
|
3
|
+
declare const SEND: unique symbol;
|
|
4
|
+
declare const GET_NEW_ID: unique symbol;
|
|
5
|
+
declare const LISTEN: unique symbol;
|
|
6
|
+
declare const TERMINATE_MESSAGE$: unique symbol;
|
|
7
|
+
declare const RESPONSE: unique symbol;
|
|
8
|
+
|
|
9
|
+
export { GET_NEW_ID, LISTEN, MESSAGE_LISTENERS, RESPONSE, RESPONSES$, SEND, TERMINATE_MESSAGE$ };
|