UNPKG

svelte-gantt

Version:

Interactive JavaScript Gantt chart/resource booking component

30 lines (29 loc) 723 B
import { ContextMenu } from '../ui'; export class ContextMenuManager { current; constructor() { this.current = null; } open(actions, position) { if (this.current) { this.current.$destroy(); } const contextMenu = new ContextMenu({ target: document.body, props: { actions, left: position.x, top: position.y, onactionend: () => contextMenu.$destroy() } }); this.current = contextMenu; return this.current; } close() { if (this.current) { this.current.$destroy(); this.current = null; } } }