cordis/client/webapp/elements/events-connection.ts

23 lines
851 B
TypeScript
Raw Normal View History

2021-10-30 17:26:41 +00:00
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' });
});
}