]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
feat(history): expose state on html5
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 24 Mar 2020 10:28:49 +0000 (11:28 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 24 Mar 2020 15:09:43 +0000 (16:09 +0100)
src/history/common.ts
src/history/html5.ts

index 506e57328b3370de966a36944b53fdf6f8699227..0eb47fffe5235d725b9610388bd8bf4d5810b4f5 100644 (file)
@@ -71,6 +71,7 @@ export type ValueContainer<T> = { value: T }
 export interface RouterHistory {
   readonly base: string
   readonly location: HistoryLocationNormalized
+  readonly state: HistoryState
   // readonly location: ValueContainer<HistoryLocationNormalized>
 
   push(to: RawHistoryLocation, data?: HistoryState): void
index a5249a078cb64f0774884c4f3b502348f668cb02..ffc7938492f2ccf07e6a83891ec28fcbdcd8fda2 100644 (file)
@@ -297,5 +297,9 @@ export default function createWebHistory(base: string = ''): RouterHistory {
     get: () => historyNavigation.location.value,
   })
 
+  Object.defineProperty(routerHistory, 'state', {
+    get: () => historyNavigation.state.value,
+  })
+
   return routerHistory
 }