RouterUtils

RouterUtils

Methods

Source:

add active classes to any active elements

Returns:
Type
function

(static) cache() → {Cache}

Source:
Returns:
Type
Cache

(static) createPathObject() → {function}

Source:
Properties:
Name Type Description
options Object

pathToRegexp options

Returns:
Type
function

(static) findRoute() → {Route}

Source:
Properties:
Name Type Description
routes Array

The routes array to search through

function used to match urls to routes

Returns:
Type
Route

(static) flattenRoutes() → {Array}

Source:
Properties:
Type Description
Array

The routes array to flatten

Flatten the nest route map into a 1 dimensional array

Returns:
  • The flattened route
Type
Array

(static) historyManager() → {History}

Source:
Returns:
Type
History

(static) lazyload() → {Lazyload}

Source:

fetch links within the viewport on a web worker

Returns:
Type
Lazyload

(static) lifecycle() → {lifecycle}

Source:

lifecycle of pages entering/exiting the dom

Returns:
Type
lifecycle
Source:
Properties:
Name Type Description
scope HTMLElement

the element to query from

adds target blank and rel noopener attributes to external links

Returns:
Type
Object

(static) mapChildren() → {function}

Source:
Properties:
Name Type Description
base String

The base path

recursively loop over any route children returns a functions that expects an array of routes

Returns:
Type
function

(static) matches() → {Array}

Source:
Properties:
Name Type Description
routes Array

The routes array to search through

data Object

data about the requested url

finds all the route matches and gives each match a score

Returns:
  • An array of matching routes
Type
Array

(static) matchRoute() → {function}

Source:
Returns:
Type
function

(static) parseUri() → {Object}

Source:
Properties:
Name Type Description
url String

the url to parse

extracts meta data from urls (queries, hash, host, et al)

Returns:
Type
Object

(static) parseUrl() → {Object}

Source:
Properties:
Name Type Description
href String

the url to parse

Returns:
Type
Object

(static) preventClick() → {Boolean}

Source:
Author:
  • https://github.com/luruke/barba.js/blob/master/src/Pjax/Pjax.js
Properties:
Name Type Description
evt Object

the event object

element HTMLElement

the anchor being tested

checks whether a link should be handled by the router

Returns:
Type
Boolean

(static) request() → {Promise}

Source:
Properties:
Name Type Description
pathname String

pathname to fetch

options Object

options to be used by fetch

type String

the type of response

Returns:
Type
Promise

(static) transition()

Source:
Properties:
Name Type Description
el String

css selector for the html to inject

onLoad function

function called on the inital load

Properties
Name Type Description
props Object

from/to/dom props

shouldUnmount function

function called before unmounting previous behaviours

Properties
Name Type Description
props Object

from/to/dom props

shouldMount function

function called before mounting next behaviours

shouldUnmount.props Object

from/to/dom props

onError function

called in the event of an error

Properties
Name Type Description
props Object

from/to/dom props

updateDom function

function used to update the dom

Properties
Name Type Description
props Object

from/to/dom props

onExit function

called when the request has been made

Properties
Name Type Description
props Object

from/to/dom props

onAfterExit function

called after the request response

Properties
Name Type Description
props Object

from/to/dom props

onEnter function

called when entering the new path

Properties
Name Type Description
props Object

from/to/dom props

onEnter function

called after entering the new path

onAfterEnter.props Object

from/to/dom props