forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstores.ts
More file actions
32 lines (27 loc) · 744 Bytes
/
Copy pathstores.ts
File metadata and controls
32 lines (27 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { getContext, setContext } from 'svelte';
function createMockedStore(contextName: string) {
return [
{
subscribe(runner: any) {
const page = getContext(contextName);
runner(page);
return () => {};
},
},
(value: unknown) => {
setContext(contextName, value);
},
] as const;
}
export const [page, setAppStoresPage] = createMockedStore('page-ctx');
export const [navigating, setAppStoresNavigating] = createMockedStore('navigating-ctx');
const [updated, setAppStoresUpdated] = createMockedStore('updated-ctx');
(updated as any).check = () => {};
export { updated, setAppStoresUpdated };
export function getStores() {
return {
page,
navigating,
updated,
};
}