presentation-router

3.2.4 • Public • Published

presentation-router

Augmented.js Presentation Router Module

API

Table of Contents

Router

Extends AugmentedObject

Routers map faux-URLs to actions, and fire events when routes are matched. Creating a new one sets its routes hash, if not set statically.
Supports passing routes to the constructor as well as a transition flag.

Parameters

  • options

Examples

const router = new Router({
   "routes": { ... },
   "transition": { "in": #, "out": # }
});

view

Properties

  • view Presentation.View Read only property to current view

loadView

Load a view safely and remove the last view by calling cleanup, then remove

Parameters

  • view View The View to load

cleanup

Remove the last view by calling cleanup, then removes

Parameters

  • oldView

initialize

Initialize is an empty function by default. Override it with your own initialization logic.

Parameters

  • options

route

Manually bind a single named route to a callback.

Parameters

Examples

this.route('search/:query/p:num', 'search', (query, num) => {
  ...
});

execute

Execute a route handler with the provided parameters. This is an excellent place to do pre-route setup or post-route cleanup.

Parameters

navigate

Simple proxy to history to save a fragment into the history.

Parameters

  • fragment string route fragment
  • options object any options to pass

startHistory

Start the history using browser History API

Parameters

  • options object any options to pass

parseQuery

Parse a query string and return as an object

Parameters

Returns object Object of the query params

History

Extends AugmentedObject

Handles cross-browser history management, based on either pushState and real URLs, or onhashchange and URL fragments.

Parameters

  • options

serialize

Serialize object into query parameters url string

Parameters

  • obj object Object to serialize

Returns string URL string

Package Sidebar

Install

npm i presentation-router

Weekly Downloads

0

Version

3.2.4

License

Apache-2.0

Unpacked Size

26.1 kB

Total Files

4

Last publish

Collaborators

  • thedocbwarren