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.
17 lines
No EOL
608 B
JavaScript
17 lines
No EOL
608 B
JavaScript
import { default as Player } from "./modules/StillAlivePlayer.mjs";
|
|
|
|
if(typeof BroadcastChannel !== "function" || !window.location.hash) {
|
|
close();
|
|
const page = window.location.pathname.split("/");
|
|
const url = window.location.href.replace(page[page.length - 1],"");
|
|
window.location.replace(url);
|
|
};
|
|
|
|
const name = window.location.hash.substring(1);
|
|
document.body.className = name;
|
|
|
|
const target = document.getElementById("player");
|
|
const player = new Player(target,name);
|
|
|
|
// Notify PlayerManager that I was closed
|
|
window.addEventListener("beforeunload",() => player.channel.postMessage("PLAYER_CLOSED")); |