UNPKG

sly-svelte-location-router

Version:

A simple svelte router based on location API

12 lines (11 loc) 369 B
import { writable } from "svelte/store"; export const resolvedRoute = writable({ path: window.location.pathname, segments: window.location.pathname.split('/').filter(Boolean) }); export const erroneousRoute = writable(null); export const currentRoute = writable({ path: window.location.pathname, parentPath: window.location.pathname, params: {} });