Skip to content

Commit 58050d4

Browse files
committed
transfer data first vlastovka
1 parent b560106 commit 58050d4

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

web/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
<script type="module" src="/src/index.jsx"></script>
2222
</body>
2323

24-
</html>
24+
</html>

web/src/Index/Home.jsx

+11
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export function Home() {
110110
<DemoLinkInput />
111111
<Uploader />
112112
<hr />
113+
<button onClick={clickeeedd}>Testt</button>
113114
<h3>Test demos</h3>
114115
<ul>
115116
<li>
@@ -143,3 +144,13 @@ export function Home() {
143144
</div>
144145
);
145146
}
147+
148+
function clickeeedd() {
149+
console.log("fjasklfjklas")
150+
window.open("/player", '_blank').focus();
151+
const channel = new BroadcastChannel("my-channel");
152+
setTimeout(() => {
153+
channel.postMessage("Hey, how's it going mate? I'm from a different tab!");
154+
}, 100)
155+
156+
}

web/src/Player/App.jsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ export function PlayerApp() {
1515

1616
useEffect(() => {
1717
console.log("run run run")
18+
// subscribe to the same channel, "my-channel"
19+
const channel = new BroadcastChannel("my-channel");
20+
21+
channel.addEventListener("message", e => {
22+
alert(e.data)
23+
});
1824
messageBus.listen([13], function (msg) {
1925
alert(msg.message)
2026
})
@@ -54,7 +60,7 @@ export function PlayerApp() {
5460
});
5561
}
5662

57-
loadWasm();
63+
// loadWasm();
5864
}, [])
5965

6066

0 commit comments

Comments
 (0)