blob: 1c43068c7ad25994d4255e3cd79127fc4cec438e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
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');
}
|