diff options
author | Joris | 2025-04-19 12:36:38 +0200 |
---|---|---|
committer | Joris | 2025-04-19 12:38:24 +0200 |
commit | 632eef6424d8dc8d40c2906177892697679e7b85 (patch) | |
tree | 48d9cd60e9e96eab810b5f7bb3c7b1fa79e0438f /src/lib/contextMenu.ts | |
parent | 063d8ef9eaf874a941f4459e831057dd0a1b7ddd (diff) |
Add ZIG server
Diffstat (limited to 'src/lib/contextMenu.ts')
-rw-r--r-- | src/lib/contextMenu.ts | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/lib/contextMenu.ts b/src/lib/contextMenu.ts deleted file mode 100644 index 6edd567..0000000 --- a/src/lib/contextMenu.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { h } from 'lib/h' - -interface Action { - label: string, - action: () => void -} - -export function show(event: MouseEvent, actions: Action[]) { - const menu = h('div', - { id: 'g-ContextMenu', - style: `left: ${event.pageX.toString()}px; top: ${event.pageY.toString()}px` - }, - ...actions.map(({ label, action }) => - h('div', - { className: 'g-ContextMenu__Entry', - onclick: () => action() - }, - label - ) - ) - ) - - document.body.appendChild(menu) - - // Remove on click or context menu - setTimeout(() => { - const f = () => { - document.body.removeChild(menu) - document.body.removeEventListener('click', f) - document.body.removeEventListener('contextmenu', f) - } - document.body.addEventListener('click', f) - document.body.addEventListener('contextmenu', f) - }, 0) -} |