NavigationInformation,
} from './common'
-// TODO: implement navigation direction in listeners
-
// const cs = console
// const cs = consola.withTag('abstract')
const routerHistory: RouterHistory = {
// rewritten by Object.defineProperty
location: START,
+ // TODO: implement it
+ base: '/',
replace(to) {
const toNormalized = normalizeLocation(to)
}
export interface RouterHistory {
- location: HistoryLocationNormalized
+ readonly base: string
+ readonly location: HistoryLocationNormalized
+
push(to: RawHistoryLocation, data?: any): void
replace(to: RawHistoryLocation): void
// TODO: should it be a stack? a Dict. Check if the popstate listener
// can trigger twice
let pauseState: HistoryLocationNormalized | null = null
- // TODO: should it be a stack? a Dict. Check if the popstate listener
- // can trigger twice
const popStateHandler: PopStateListener = ({
state,
cs.info('popstate fired', state)
cs.info('currentState', historyState)
- // TODO: handle go(-2) and go(2) (skipping entries)
-
const from = location
const fromState = historyState
const to = createCurrentLocation(window.location)
const routerHistory: RouterHistory = {
// it's overriden right after
location,
+ // TODO: implement it
+ base: '/',
replace(to) {
const normalized = normalizeLocation(to)