Fix an issue that caused messages to double if you clicked a vm more than once

Expose the multicollab function
This commit is contained in:
elijahr2411 2023-01-26 11:33:48 -05:00
parent b9cd8b763a
commit bf43f2533d

View file

@ -6,6 +6,7 @@ import { GetKeysym } from "./keyboard";
// In queue = <queue position> // In queue = <queue position>
var turn = -1; var turn = -1;
var perms = 0; var perms = 0;
var connected = false;
const vms = []; const vms = [];
const users = []; const users = [];
const buttons = { const buttons = {
@ -348,6 +349,8 @@ function chatMessage(username, msg) {
chatList.appendChild(tr); chatList.appendChild(tr);
} }
async function openVM(url, node) { async function openVM(url, node) {
if (connected) return;
connected = true;
vm = new CollabVMClient(url); vm = new CollabVMClient(url);
await vm.connect(); await vm.connect();
connected = true; connected = true;
@ -399,4 +402,5 @@ votenobtn.addEventListener('click', () => vm.voteReset(false));
config.serverAddresses.forEach(multicollab); config.serverAddresses.forEach(multicollab);
// Export some stuff // Export some stuff
window.screenshotVM = screenshotVM; window.screenshotVM = screenshotVM;
window.multicollab = multicollab;