import { writable } from 'svelte/store'; interface TabDefinition { title: string; closedTime?: number; icon: string; props: any; selected: boolean; busy: boolean; tabid: string; } export function writableWithStorage(defaultValue: T, storageName) { const init = localStorage.getItem(storageName); const res = writable(init ? JSON.parse(init) : defaultValue); res.subscribe(value => { localStorage.setItem(storageName, JSON.stringify(value)); }); return res; } export const selectedWidget = writable('database'); export const openedConnections = writable([]); export const currentDatabase = writable(null); export const openedTabs = writableWithStorage([], 'openedTabs'); // export const leftPanelWidth = writable(300);