Skip to content

Commit e3ce8ef

Browse files
Add setStartUrl tab update when query param set
1 parent 53666af commit e3ce8ef

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

main.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Hyperbeam from "@hyperbeam/web"
1818
}
1919
const body = await req.json()
2020
if (body.room !== room) {
21-
history.replaceState(null, null, "/" + body.room)
21+
history.replaceState(null, null, "/" + body.room + location.search)
2222
}
2323
embedURL = body.url
2424
}
@@ -139,6 +139,7 @@ async function main(embedURL) {
139139
window.addEventListener("pointerdown", onPointerDown)
140140
window.addEventListener("pointerup", onPointerUp)
141141

142+
setStartURL()
142143
onWindowResized()
143144
animate()
144145

@@ -223,6 +224,14 @@ async function main(embedURL) {
223224
controls.update()
224225
renderer.render(scene, camera)
225226
}
227+
228+
function setStartURL() {
229+
const params = new URLSearchParams(location.search)
230+
const startURL = params.get('url')
231+
if (startURL) {
232+
hb.tabs.update({url: startURL})
233+
}
234+
}
226235
}
227236

228237
function checkerboardMesh(width, segments) {

0 commit comments

Comments
 (0)