UNPKG

svelte5-router

Version:

A declarative Svelte routing library with SSR support

11 lines (10 loc) 434 B
import { getContext } from "svelte"; import { readable, writable } from "svelte/store"; import { globalHistory } from "./history"; export const LOCATION = {}; export const ROUTER = {}; export const HISTORY = {}; export const useInternalLocation = () => getContext(LOCATION); export const useLocation = () => getContext(LOCATION); export const useRouter = () => getContext(ROUTER); export const useHistory = () => getContext(HISTORY);