import IState from "./require/elements-state"; import Elements from '../elements'; import ElementsUtil from './require/elements-util.js'; import { $, $$, $$$, $$$$ } from './require/q-module'; import ClientController from "../client-controller"; export default function bindConnectionEvents(state: IState): void { const { document, ui } = state; $.setDocument(document); $('#connection').addEventListener('click', () => { if (!ui.hasActiveServer()) return; if (!(ui.activeServer as ClientController).isVerified) return; let contextMenu = Elements.createConnectionContextMenu(ui.activeServer as ClientController); document.body.appendChild(contextMenu); ElementsUtil.alignContextElement(contextMenu, $('#connection'), { bottom: 'top', centerX: 'centerX' }); }); }