This commit is contained in:
Daniel Maixner 2023-06-13 18:09:03 +02:00
parent 3373db6685
commit 87b2ae0619
2 changed files with 6 additions and 8 deletions

View File

@ -80,10 +80,7 @@ let launchGame
setting.addUpdateCallback('sensitivity', (newValue) => pointerLock.pointerSpeed = parseFloat(newValue))
setting.addUpdateCallback('volume', (newValue) => world.volume = parseFloat(newValue))
connector.connect(url.hostname, url.port, loginCode, control)
if (window.nodeApi) {
window.addEventListener('beforeunload', () => connector.close());
}
window.addEventListener('beforeunload', () => connector.close());
}
function render() {

View File

@ -109,14 +109,15 @@
<script>
if (window.nodeApi) {
document.getElementById('join-url').value = 'udp://localhost:8080?map=default&code=acode'
} else {
window.addEventListener('beforeunload', (e) => {
e.preventDefault();
return "Are you sure to leave this page?"
});
}
if (window.location.search === '?dev-join') {
joinGameUrl(document.getElementById('join-url').value)
}
window.addEventListener('beforeunload', (e) => {
e.preventDefault();
return "Are you sure to leave this page?"
});
</script>
</body>
</html>