BREAKING CHANGE: `createHistory` is now named `createWebHistory`.
`createHashHistory` is now named `createWebHashHistory`.
Both createHistory and createHashHistory are renamed to
better reflect that they must be used in a browser environment while
createMemoryHistory doesn't.
import fakePromise from 'faked-promise'
import { NAVIGATION_TYPES, createDom, noGuard } from '../utils'
import { RouteRecord, NavigationGuard } from '../../src/types'
-import { createHistory } from '../../src'
+import { createWebHistory } from '../../src'
function createRouter(
options: Partial<RouterOptions> & { routes: RouteRecord[] }
) {
return newRouter({
- history: createHistory(),
+ history: createWebHistory(),
...options,
})
}
import { RouterOptions, createRouter as newRouter } from '../../src/router'
import { NAVIGATION_TYPES, createDom, noGuard } from '../utils'
import { RouteRecord } from '../../src/types'
-import { createHistory } from '../../src'
+import { createWebHistory } from '../../src'
// TODO: refactor in utils
function createRouter(
options: Partial<RouterOptions> & { routes: RouteRecord[] }
) {
return newRouter({
- history: createHistory(),
+ history: createWebHistory(),
...options,
})
}
import fakePromise from 'faked-promise'
import { NAVIGATION_TYPES, createDom, noGuard } from '../utils'
-import { createRouter as newRouter, createHistory } from '../../src'
+import { createRouter as newRouter, createWebHistory } from '../../src'
import { RouteRecord } from '../../src/types'
function createRouter(
}
) {
return newRouter({
- history: createHistory(),
+ history: createWebHistory(),
...options,
})
}
import { NAVIGATION_TYPES, createDom } from '../utils'
-import { createHistory, createRouter as newRouter } from '../../src'
+import { createWebHistory, createRouter as newRouter } from '../../src'
function createRouter(
options: Partial<import('../../src/router').RouterOptions> & {
}
) {
return newRouter({
- history: createHistory(),
+ history: createWebHistory(),
...options,
})
}
import fakePromise from 'faked-promise'
import { NAVIGATION_TYPES, createDom, tick, noGuard } from '../utils'
import { RouteRecord, RouteLocation } from '../../src/types'
-import { createHistory, createRouter as newRouter } from '../../src'
+import { createWebHistory, createRouter as newRouter } from '../../src'
function createRouter(
options: Partial<RouterOptions> & { routes: RouteRecord[] }
) {
return newRouter({
- history: createHistory(),
+ history: createWebHistory(),
...options,
})
}
import fakePromise from 'faked-promise'
import { NAVIGATION_TYPES, createDom, noGuard, tick } from '../utils'
import { RouteRecord } from '../../src/types'
-import { createHistory } from '../../src'
+import { createWebHistory } from '../../src'
function createRouter(
options: Partial<RouterOptions> & { routes: RouteRecord[] }
) {
return newRouter({
- history: createHistory(),
+ history: createWebHistory(),
...options,
})
}
-import createHistory from '../../src/history/html5'
+import createWebHistory from '../../src/history/html5'
import { createDom } from '../utils'
// TODO: is it really worth testing this implementation on jest or is it
})
it('can be instantiated', () => {
- const history = createHistory()
+ const history = createWebHistory()
expect(history.location).toEqual({
fullPath: '/',
path: '/',
import fakePromise from 'faked-promise'
-import { createRouter, createMemoryHistory, createHistory } from '../src'
+import { createRouter, createMemoryHistory, createWebHistory } from '../src'
import { NavigationCancelled } from '../src/errors'
import { createDom, components, tick } from './utils'
import {
})
it('allows base option with html5 history', async () => {
- const history = createHistory('/app/')
+ const history = createWebHistory('/app/')
const router = createRouter({ history, routes })
expect(router.currentRoute.value).toEqual({
name: undefined,
// this function is meant to easy refactor in the future as Histories are going to be
// function-based
-function createHistory() {
+function createWebHistory() {
const routerHistory = createMemoryHistory()
return routerHistory
}
function createRouter() {
- const history = createHistory()
+ const history = createWebHistory()
const router = newRouter({ history, routes })
return router
}
-import { createRouter, createHistory } from '../src'
+import { createRouter, createWebHistory } from '../src'
import Home from './views/Home.vue'
import Nested from './views/Nested.vue'
import User from './views/User.vue'
// const hist = new HTML5History()
// const hist = new HashHistory()
-export const routerHistory = createHistory()
+export const routerHistory = createWebHistory()
export const router = createRouter({
history: routerHistory,
routes: [
import { RouterHistory } from './common'
-import createHistory from './html5'
+import createWebHistory from './html5'
-export default function createHashHistory(base: string = ''): RouterHistory {
+export default function createWebHashHistory(base: string = ''): RouterHistory {
// Make sure this implementation is fine in terms of encoding, specially for IE11
- return createHistory('/#' + base)
+ return createWebHistory('/#' + base)
}
}
}
-export default function createHistory(base: string = ''): RouterHistory {
+export default function createWebHistory(base: string = ''): RouterHistory {
const historyNavigation = useHistoryStateNavigation(base)
const historyListeners = useHistoryListeners(
base,
-import createHistory from './history/html5'
+import createWebHistory from './history/html5'
import createMemoryHistory from './history/memory'
-import createHashHistory from './history/hash'
+import createWebHashHistory from './history/hash'
export {
RouteLocationNormalized,
export { Link } from './components/Link'
export { View } from './components/View'
-export { createHistory, createMemoryHistory, createHashHistory }
+export { createWebHistory, createMemoryHistory, createWebHashHistory }