mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-11-26 07:33:23 +03:00
20 lines
449 B
TypeScript
20 lines
449 B
TypeScript
import { writable } from 'svelte/store';
|
|
|
|
interface ContextMenuState {
|
|
id: string | null;
|
|
x: number;
|
|
y: number;
|
|
}
|
|
|
|
function createContextMenuStore() {
|
|
const { subscribe, set } = writable<ContextMenuState>({ id: null, x: 0, y: 0 });
|
|
|
|
return {
|
|
subscribe,
|
|
open: (id: string, x: number, y: number) => set({ id, x, y }),
|
|
close: () => set({ id: null, x: 0, y: 0 }),
|
|
};
|
|
}
|
|
|
|
export const activeContextMenu = createContextMenuStore();
|