Skip to content
Snippets Groups Projects
script.js 517 B
Newer Older
import Signaler from "./Signaler.js";

document.addEventListener("DOMContentLoaded",async()=>{
	if (document.location.hash){
		document.body.innerHTML = "";
		await Signaler.join(document.location.hash.substring(1));
	}else{
		/** @type {HTMLButtonElement} *///@ts-ignore
		const button = document.getElementById("button");
		button.addEventListener("click",async e=>{
			button.disabled = true;
			let id = await Signaler.host(()=>{});
			alert(document.location.host+document.location.pathname+"#"+id);
		});
	}