Erant-OldApp/src/lib/router/navigate.ts

10 lines
360 B
TypeScript
Raw Normal View History

2022-12-01 11:25:45 +00:00
import { navigate as nav } from 'svelte-routing'
export const navigate = (to: string | number, options?: { replace?: boolean, state?: { [k in string | number]: unknown } }) => {
if (typeof to === 'string') return nav(to, options)
window.history.go(to)
}
export const back = () => window.history.back()
export const forward = () => window.history.forward()