starpc 0.3.0 → 0.3.1
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.
|
@@ -8,6 +8,7 @@ export declare class BroadcastChannelIterable<T> implements Duplex<T> {
|
|
|
8
8
|
sink: Sink<T>;
|
|
9
9
|
source: AsyncIterable<T>;
|
|
10
10
|
constructor(readChannel: BroadcastChannel, writeChannel: BroadcastChannel);
|
|
11
|
+
close(): void;
|
|
11
12
|
private _createSink;
|
|
12
13
|
private _createSource;
|
|
13
14
|
}
|
|
@@ -17,4 +18,5 @@ export declare class BroadcastChannelConn extends DuplexConn {
|
|
|
17
18
|
constructor(readChannel: BroadcastChannel, writeChannel: BroadcastChannel, server?: Server, connParams?: ConnParams);
|
|
18
19
|
getReadChannel(): BroadcastChannel;
|
|
19
20
|
getWriteChannel(): BroadcastChannel;
|
|
21
|
+
close(): void;
|
|
20
22
|
}
|
|
@@ -16,6 +16,11 @@ export class BroadcastChannelIterable {
|
|
|
16
16
|
this.sink = this._createSink();
|
|
17
17
|
this.source = this._createSource();
|
|
18
18
|
}
|
|
19
|
+
// close closes the broadcast channels.
|
|
20
|
+
close() {
|
|
21
|
+
this.readChannel.close();
|
|
22
|
+
this.writeChannel.close();
|
|
23
|
+
}
|
|
19
24
|
// _createSink initializes the sink field.
|
|
20
25
|
_createSink() {
|
|
21
26
|
return async (source) => {
|
|
@@ -62,4 +67,8 @@ export class BroadcastChannelConn extends DuplexConn {
|
|
|
62
67
|
getWriteChannel() {
|
|
63
68
|
return this.broadcastChannel.writeChannel;
|
|
64
69
|
}
|
|
70
|
+
// close closes the read and write channels.
|
|
71
|
+
close() {
|
|
72
|
+
this.broadcastChannel.close();
|
|
73
|
+
}
|
|
65
74
|
}
|
|
@@ -8,6 +8,7 @@ export declare class MessagePortIterable<T> implements Duplex<T> {
|
|
|
8
8
|
source: AsyncIterable<T>;
|
|
9
9
|
private _source;
|
|
10
10
|
constructor(port: MessagePort);
|
|
11
|
+
close(): void;
|
|
11
12
|
private _createSink;
|
|
12
13
|
private _createSource;
|
|
13
14
|
}
|
|
@@ -16,4 +17,5 @@ export declare class MessagePortConn extends DuplexConn {
|
|
|
16
17
|
private messagePort;
|
|
17
18
|
constructor(port: MessagePort, server?: Server, connParams?: ConnParams);
|
|
18
19
|
getMessagePort(): MessagePort;
|
|
20
|
+
close(): void;
|
|
19
21
|
}
|
|
@@ -16,6 +16,10 @@ export class MessagePortIterable {
|
|
|
16
16
|
this._source = this._createSource();
|
|
17
17
|
this.source = this._source;
|
|
18
18
|
}
|
|
19
|
+
// close closes the message port.
|
|
20
|
+
close() {
|
|
21
|
+
this.port.close();
|
|
22
|
+
}
|
|
19
23
|
// _createSink initializes the sink field.
|
|
20
24
|
_createSink() {
|
|
21
25
|
return async (source) => {
|
|
@@ -58,4 +62,8 @@ export class MessagePortConn extends DuplexConn {
|
|
|
58
62
|
getMessagePort() {
|
|
59
63
|
return this.messagePort.port;
|
|
60
64
|
}
|
|
65
|
+
// close closes the message port.
|
|
66
|
+
close() {
|
|
67
|
+
this.messagePort.close();
|
|
68
|
+
}
|
|
61
69
|
}
|
package/package.json
CHANGED
|
@@ -23,6 +23,12 @@ export class BroadcastChannelIterable<T> implements Duplex<T> {
|
|
|
23
23
|
this.source = this._createSource()
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// close closes the broadcast channels.
|
|
27
|
+
public close() {
|
|
28
|
+
this.readChannel.close()
|
|
29
|
+
this.writeChannel.close()
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
// _createSink initializes the sink field.
|
|
27
33
|
private _createSink(): Sink<T> {
|
|
28
34
|
return async (source) => {
|
|
@@ -90,4 +96,9 @@ export class BroadcastChannelConn extends DuplexConn {
|
|
|
90
96
|
public getWriteChannel(): BroadcastChannel {
|
|
91
97
|
return this.broadcastChannel.writeChannel
|
|
92
98
|
}
|
|
99
|
+
|
|
100
|
+
// close closes the read and write channels.
|
|
101
|
+
public close() {
|
|
102
|
+
this.broadcastChannel.close()
|
|
103
|
+
}
|
|
93
104
|
}
|
package/srpc/message-port.ts
CHANGED
|
@@ -23,6 +23,11 @@ export class MessagePortIterable<T> implements Duplex<T> {
|
|
|
23
23
|
this.source = this._source
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// close closes the message port.
|
|
27
|
+
public close() {
|
|
28
|
+
this.port.close()
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
// _createSink initializes the sink field.
|
|
27
32
|
private _createSink(): Sink<T> {
|
|
28
33
|
return async (source) => {
|
|
@@ -73,4 +78,9 @@ export class MessagePortConn extends DuplexConn {
|
|
|
73
78
|
public getMessagePort(): MessagePort {
|
|
74
79
|
return this.messagePort.port
|
|
75
80
|
}
|
|
81
|
+
|
|
82
|
+
// close closes the message port.
|
|
83
|
+
public close() {
|
|
84
|
+
this.messagePort.close()
|
|
85
|
+
}
|
|
76
86
|
}
|