-import { ListenerRemover } from '../types'
import { LocationQueryRaw, LocationQuery } from '../utils/query'
interface HistoryLocation {
forward(triggerListeners?: boolean): void
go(distance: number, triggerListeners?: boolean): void
- listen(callback: NavigationCallback): ListenerRemover
+ listen(callback: NavigationCallback): () => void
destroy(): void
}
import { inject } from 'vue'
import { routerKey, routeLocationKey } from './utils/injectionSymbols'
+export { LocationQuery, parseQuery, stringifyQuery } from './utils/query'
+
export { RouterHistory } from './history/common'
+export { RouteRecordNormalized } from './matcher/types'
+
export {
RouteLocationNormalized,
- RouteLocationOptions,
+ RouteLocationNormalizedResolved,
START_LOCATION_NORMALIZED as START_LOCATION,
+ RouteParams,
+ RouteLocationOptions,
+ RouteRecord,
+ NavigationGuard,
+ PostNavigationGuard,
} from './types'
-export { createRouter, Router, RouterOptions } from './router'
+export { createRouter, Router, RouterOptions, ErrorHandler } from './router'
export { onBeforeRouteLeave } from './navigationGuards'
export { Link } from './components/Link'
RouteRecord,
MatcherLocation,
MatcherLocationNormalized,
- ListenerRemover,
} from '../types'
import { createRouterError, ErrorTypes, MatcherError } from '../errors'
import { createRouteRecordMatcher, RouteRecordMatcher } from './path-matcher'
let noop = () => {}
interface RouterMatcher {
- addRoute: (
- record: RouteRecord,
- parent?: RouteRecordMatcher
- ) => ListenerRemover
+ addRoute: (record: RouteRecord, parent?: RouteRecordMatcher) => () => void
removeRoute: {
(matcher: RouteRecordMatcher): void
(name: Required<RouteRecord>['name']): void
RouteRecord,
RouteLocation,
NavigationGuard,
- ListenerRemover,
PostNavigationGuard,
START_LOCATION_NORMALIZED,
Lazy,
import { View } from './components/View'
import { routerKey, routeLocationKey } from './utils/injectionSymbols'
-type ErrorHandler = (error: any) => any
+/**
+ * Internal type to define an ErrorHandler
+ * @internal
+ */
+export type ErrorHandler = (error: any) => any
// resolve, reject arguments of Promise constructor
type OnReadyCallback = [() => void, (reason?: any) => void]
push(to: RouteLocation): Promise<RouteLocationNormalizedResolved>
replace(to: RouteLocation): Promise<RouteLocationNormalizedResolved>
- beforeEach(guard: NavigationGuard<undefined>): ListenerRemover
- afterEach(guard: PostNavigationGuard): ListenerRemover
+ beforeEach(guard: NavigationGuard<undefined>): () => void
+ afterEach(guard: PostNavigationGuard): () => void
- onError(handler: ErrorHandler): ListenerRemover
+ onError(handler: ErrorHandler): () => void
isReady(): Promise<void>
install(app: App): void
export type TODO = any
-export type ListenerRemover = () => void
-
export type RouteParamValue = string
// TODO: should we allow more values like numbers and normalize them to strings?
// type RouteParamValueRaw = RouteParamValue | number
}
export interface LocationAsRelative {
- params?: RouteParams
+ params?: RouteParamsRaw
}
export interface RouteLocationOptions {