blob: 1c43068c7ad25994d4255e3cd79127fc4cec438e (
plain) (
tree)
|
|
import { getContext, setContext } from 'svelte';
import { writable, type Writable } from 'svelte/store';
type Tab = string;
type Tabs = Record<Tab, { title: string; badge?: boolean }>;
interface TabContext {
tabs: Tabs;
current: Tab;
}
export function setTabContext(context: TabContext) {
return setContext<Writable<TabContext>>('tabs', writable(context));
}
export function getTabContext() {
return getContext<Writable<TabContext>>('tabs');
}
|