0.0.0-developmentRouter class.
(Object
= {})
| Name | Description |
|---|---|
$0.routes any
(default [])
|
|
$0.components any
(default {})
|
|
$0.basePath any
(default '/')
|
|
$0.mode any
(default Router.BROWSER_MODE)
|
|
$0.locale any
(default '')
|
|
$0.preRendered any
(default false)
|
|
$0.restoreScroll any
(default false)
|
|
$0.debugMode any
(default false)
|
(Object
= {})
Options.
const routes = [{
name: 'home',
callback: route => { },
path: '/'
}]
const router = new Router({ routes })
Mount.
((String | HTMLElement))
DOM element to mount the router on.
Navigate.
Go to the previous history entry.
Go to the next history entry.
Starts with.
Boolean:
True if given string starts with given prefix,
else otherwise.
Ends with.
Boolean:
True if given string ends with given suffix,
else otherwise.
Add leading slash.
(String)
String.
String:
String with a leading slash.
Strip leading slash.
(String)
String.
String:
String without leading slash.
Strip trailing slash.
(String)
String.
String:
String without trailing slash.
Strip slashes.
(String)
String.
String:
String without slashes.
Is string.
(any)
String.
Boolean:
True if it is a string, false otherwise.
Get hash from a path.
(String
= window.location.href)
Href.
String:
Hash extracted.
Generate spaces.
(String)
String.
String:
Spaces corresponding to given string length.
Check browser history support.
Boolean:
True if browser history is supported, false otherwise.
Check scroll restoration support.
Boolean:
True if scroll restoration is supported, false otherwise.