Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyWebb committed Mar 14, 2017
1 parent 082d2b3 commit 4e3f714
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ export default class Router {
return await Router.head.update(url, _args)
}

static getPathFromLocation(): string {
const path = location.pathname + location.search + location.hash
const baseWithOrWithoutHashbangRegexp = Router.config.base.replace('#!', '#?!?')
return path.replace(new RegExp(baseWithOrWithoutHashbangRegexp, 'i'), '')
}

private static onclick(e) {
if (e.defaultPrevented) {
return
Expand Down Expand Up @@ -347,12 +353,6 @@ export default class Router {
e.preventDefault()
}

static getPathFromLocation() {
const path = location.pathname + location.search + location.hash
const baseWithOrWithoutHashbangRegexp = Router.config.base.replace('#!', '#?!?')
return path.replace(new RegExp(baseWithOrWithoutHashbangRegexp, 'i'), '')
}

private static onpopstate(e) {
Router.update(Router.getPathFromLocation(), false)
e.preventDefault()
Expand Down

0 comments on commit 4e3f714

Please sign in to comment.