mirror of
https://codeberg.org/vlw/still-alive.git
synced 2025-09-14 00:13:41 +02:00
Monkeydo events will now be executed through the Proxy created in 8b659066cc
This commit also implements a solution for #3 by having each window report to its PlayerManager when it has been closed.
25 lines
No EOL
669 B
JavaScript
Executable file
25 lines
No EOL
669 B
JavaScript
Executable file
import { default as Player } from "./modules/PlayerManager.mjs";
|
|
|
|
const play = document.getElementById("play");
|
|
|
|
function info(text = "") {
|
|
const element = document.getElementById("message");
|
|
element.innerText = text;
|
|
}
|
|
|
|
if(typeof BroadcastChannel !== "function") {
|
|
play.classList.add("unsupported");
|
|
info("Your browser can not play this demo");
|
|
}
|
|
|
|
play.addEventListener("click",() => {
|
|
try {
|
|
info();
|
|
new Player();
|
|
}
|
|
catch(except) {
|
|
if(except.message === "WINDOW_OPEN_FAILED") return info("Yikes! Player windows could not be created. Allow this page to open pop-ups, it will be worth it!");
|
|
// Cannot handle this exception, rethrow
|
|
throw except;
|
|
}
|
|
}); |