@cascateer/core 2.2.26 → 2.2.28
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/package.json
CHANGED
package/src/multicast.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
Observable,
|
|
10
10
|
scan,
|
|
11
11
|
share,
|
|
12
|
-
tap,
|
|
13
12
|
} from "rxjs";
|
|
14
13
|
import { v4 } from "uuid";
|
|
15
14
|
import { property } from "./lib";
|
|
@@ -94,7 +93,6 @@ self.addEventListener("connect", ({ ports }) => {
|
|
|
94
93
|
exchangeWith<MulticastClientMessage, MulticastActionMessage<any>>(port),
|
|
95
94
|
map((message) => ({ ...message, origin: port })),
|
|
96
95
|
concat(),
|
|
97
|
-
tap((messages) => port.postMessage(messages)),
|
|
98
96
|
flatMap((messages) =>
|
|
99
97
|
thru(
|
|
100
98
|
partition(messages, (message) => message.type === "connect"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromEvent, map, Observable, OperatorFunction } from "rxjs";
|
|
1
|
+
import { fromEvent, map, Observable, OperatorFunction, tap } from "rxjs";
|
|
2
2
|
import { property } from "../lib";
|
|
3
3
|
|
|
4
4
|
export const exchangeWith =
|
|
@@ -8,7 +8,7 @@ export const exchangeWith =
|
|
|
8
8
|
(messages) =>
|
|
9
9
|
new Observable<InMessage>((subscriber) => {
|
|
10
10
|
fromEvent<MessageEvent<any>>(port, "message")
|
|
11
|
-
.pipe(map(property("data")))
|
|
11
|
+
.pipe(map(property("data")), tap(console.log))
|
|
12
12
|
.subscribe(subscriber);
|
|
13
13
|
|
|
14
14
|
port.start();
|
|
@@ -91,12 +91,12 @@ export const multicast = <Seed>(
|
|
|
91
91
|
}),
|
|
92
92
|
),
|
|
93
93
|
concatMap((message) => key.then((key) => message({ key, id: v4() }))),
|
|
94
|
+
tap((message) => console.log("out", message)),
|
|
94
95
|
exchangeWith<MulticastHostMessage, MulticastClientMessage>(
|
|
95
96
|
new SharedWorker(new URL("../multicast.ts", import.meta.url), {
|
|
96
97
|
type: "module",
|
|
97
98
|
}).port,
|
|
98
99
|
),
|
|
99
|
-
tap((message) => console.log(message)),
|
|
100
100
|
shareReplay({ refCount: false }),
|
|
101
101
|
),
|
|
102
102
|
);
|