From 72169d314181aff5fffe951d037bc626325c7f8c Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Sat, 12 Oct 2019 17:03:41 +0200 Subject: [PATCH] refactor: remove old comments, add wip base to history --- src/history/abstract.2.ts | 4 ++-- src/history/common.ts | 4 +++- src/history/html5.2.ts | 6 ++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/history/abstract.2.ts b/src/history/abstract.2.ts index 3aeb6f32..8ce4e3bb 100644 --- a/src/history/abstract.2.ts +++ b/src/history/abstract.2.ts @@ -11,8 +11,6 @@ import { NavigationInformation, } from './common' -// TODO: implement navigation direction in listeners - // const cs = console // const cs = consola.withTag('abstract') @@ -55,6 +53,8 @@ export default function createMemoryHistory(): RouterHistory { const routerHistory: RouterHistory = { // rewritten by Object.defineProperty location: START, + // TODO: implement it + base: '/', replace(to) { const toNormalized = normalizeLocation(to) diff --git a/src/history/common.ts b/src/history/common.ts index e4f7ccca..a78f3e65 100644 --- a/src/history/common.ts +++ b/src/history/common.ts @@ -76,7 +76,9 @@ export const START: HistoryLocationNormalized = { } export interface RouterHistory { - location: HistoryLocationNormalized + readonly base: string + readonly location: HistoryLocationNormalized + push(to: RawHistoryLocation, data?: any): void replace(to: RawHistoryLocation): void diff --git a/src/history/html5.2.ts b/src/history/html5.2.ts index a56b7fb6..c964c5bf 100644 --- a/src/history/html5.2.ts +++ b/src/history/html5.2.ts @@ -90,8 +90,6 @@ export default function createHistory(): RouterHistory { // TODO: should it be a stack? a Dict. Check if the popstate listener // can trigger twice let pauseState: HistoryLocationNormalized | null = null - // TODO: should it be a stack? a Dict. Check if the popstate listener - // can trigger twice const popStateHandler: PopStateListener = ({ state, @@ -101,8 +99,6 @@ export default function createHistory(): RouterHistory { cs.info('popstate fired', state) cs.info('currentState', historyState) - // TODO: handle go(-2) and go(2) (skipping entries) - const from = location const fromState = historyState const to = createCurrentLocation(window.location) @@ -163,6 +159,8 @@ export default function createHistory(): RouterHistory { const routerHistory: RouterHistory = { // it's overriden right after location, + // TODO: implement it + base: '/', replace(to) { const normalized = normalizeLocation(to) -- 2.47.2