From 3f83607c8798960f49cdb5eed8fdfe8adc52fabf Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 24 Mar 2020 11:28:49 +0100 Subject: [PATCH] feat(history): expose state on html5 --- src/history/common.ts | 1 + src/history/html5.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/history/common.ts b/src/history/common.ts index 506e5732..0eb47fff 100644 --- a/src/history/common.ts +++ b/src/history/common.ts @@ -71,6 +71,7 @@ export type ValueContainer = { value: T } export interface RouterHistory { readonly base: string readonly location: HistoryLocationNormalized + readonly state: HistoryState // readonly location: ValueContainer push(to: RawHistoryLocation, data?: HistoryState): void diff --git a/src/history/html5.ts b/src/history/html5.ts index a5249a07..ffc79384 100644 --- a/src/history/html5.ts +++ b/src/history/html5.ts @@ -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 } -- 2.47.3