@ionic/vue-router
Advanced tools
Comparing version 5.4.0-dev.202008071700.eb108c5 to 5.4.0-dev.202008072023.25340c8
@@ -6,3 +6,4 @@ import { RouteInfo } from './types'; | ||
add: (routeInfo: RouteInfo) => void; | ||
pop: () => RouteInfo; | ||
canGoBack: (deep?: number) => boolean; | ||
}; |
@@ -5,5 +5,2 @@ export const createLocationHistory = () => { | ||
switch (routeInfo.routerAction) { | ||
case "pop": | ||
popRoute(routeInfo); | ||
break; | ||
case "replace": | ||
@@ -21,33 +18,12 @@ replaceRoute(routeInfo); | ||
}; | ||
const addRoute = (routeInfo) => { | ||
// TODO add tabs support | ||
locationHistory.push(routeInfo); | ||
}; | ||
const popRoute = (routeInfo) => { | ||
// TODO add tabs support | ||
let lastRoute = locationHistory[locationHistory.length - 1]; | ||
while (lastRoute && lastRoute.id !== routeInfo.id) { | ||
locationHistory.pop(); | ||
lastRoute = locationHistory[locationHistory.length - 1]; | ||
} | ||
replaceRoute(routeInfo); | ||
}; | ||
const replaceRoute = (routeInfo) => { | ||
// TODO add tabs support | ||
locationHistory.pop(); | ||
pop(); | ||
addRoute(routeInfo); | ||
}; | ||
const clearHistory = () => { | ||
// TODO add tabs support | ||
locationHistory.length = 0; | ||
}; | ||
const previous = () => { | ||
return locationHistory[locationHistory.length - 2] || current(); | ||
}; | ||
const current = () => { | ||
return locationHistory[locationHistory.length - 1]; | ||
}; | ||
const canGoBack = (deep = 1) => { | ||
return locationHistory.length > deep; | ||
}; | ||
const pop = () => locationHistory.pop(); | ||
const addRoute = (routeInfo) => locationHistory.push(routeInfo); | ||
const clearHistory = () => locationHistory.length = 0; | ||
const previous = () => locationHistory[locationHistory.length - 2] || current(); | ||
const current = () => locationHistory[locationHistory.length - 1]; | ||
const canGoBack = (deep = 1) => locationHistory.length > deep; | ||
return { | ||
@@ -57,2 +33,3 @@ current, | ||
add, | ||
pop, | ||
canGoBack | ||
@@ -59,0 +36,0 @@ }; |
@@ -13,2 +13,3 @@ import { Router, RouteLocationNormalized, RouteLocationNormalizedLoaded, RouterOptions } from 'vue-router'; | ||
add: (routeInfo: RouteInfo) => void; | ||
pop: () => RouteInfo; | ||
canGoBack: (deep?: number) => boolean; | ||
@@ -15,0 +16,0 @@ }; |
@@ -50,4 +50,8 @@ import { createLocationHistory } from './locationHistory'; | ||
routeInfo = Object.assign(Object.assign({}, incomingRouteParams), { id: generateId('routeInfo'), lastPathname: leavingLocationInfo.pathname, pathname: to.path, search: to.fullPath.split('?')[1] || '', params: to.params }); | ||
// TODO add tabs support | ||
locationHistory.add(routeInfo); | ||
if (incomingRouteParams.routerAction === 'pop') { | ||
locationHistory.pop(); | ||
} | ||
else { | ||
locationHistory.add(routeInfo); | ||
} | ||
} | ||
@@ -54,0 +58,0 @@ else { |
@@ -10,2 +10,3 @@ import { RouteInfo, ViewItem } from './types'; | ||
registerIonPage: (viewItem: ViewItem, ionPage: HTMLElement) => void; | ||
getViewStack: (outletId: number) => ViewItem[]; | ||
}; |
import { generateId } from './utils'; | ||
export const createViewStacks = () => { | ||
let viewStacks = {}; | ||
const getViewStack = (outletId) => { | ||
return viewStacks[outletId]; | ||
}; | ||
const registerIonPage = (viewItem, ionPage) => { | ||
@@ -81,5 +84,6 @@ viewItem.ionPageElement = ionPage; | ||
remove, | ||
registerIonPage | ||
registerIonPage, | ||
getViewStack | ||
}; | ||
}; | ||
//# sourceMappingURL=viewStacks.js.map |
{ | ||
"name": "@ionic/vue-router", | ||
"version": "5.4.0-dev.202008071700.eb108c5", | ||
"version": "5.4.0-dev.202008072023.25340c8", | ||
"description": "Vue Router integration for @ionic/vue", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20662
321