Augmented.js Presentation Router Module
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.
options
const router = new Router({
"routes": { ... },
"transition": { "in": #, "out": # }
});
view
Presentation.View Read only property to current view
Load a view safely and remove the last view by calling cleanup, then remove
view
View The View to load
Remove the last view by calling cleanup, then removes
oldView
Initialize is an empty function by default. Override it with your own initialization logic.
options
Manually bind a single named route to a callback.
this.route('search/:query/p:num', 'search', (query, num) => {
...
});
Execute a route handler with the provided parameters. This is an excellent place to do pre-route setup or post-route cleanup.
Simple proxy to history
to save a fragment into the history.
Start the history using browser History API
options
object any options to pass
Parse a query string and return as an object
queryString
string
Returns object Object of the query params
Extends AugmentedObject
Handles cross-browser history management, based on either pushState and real URLs, or onhashchange and URL fragments.
options
Serialize object into query parameters url string
obj
object Object to serialize
Returns string URL string