MultiplayerMinesweeper/www/scripts/interface/mainmenu/menu.js

17 lines
502 B
JavaScript

import * as status from "../../net/status.js"
import {joinGame} from "/scripts/net/netcode.js"
import { changeScene } from "/scripts/interface/scene.js"
document.getElementById("submit").addEventListener("click", e => {
submit(e)
});
function submit(event) {
const room = document.getElementById("room").value
const name = document.getElementById("name").value
if (room == '' || name == '' || status.get() == 'disconnected') return
joinGame({room: room, name: name})
event.preventDefault();
}