Skip to content

retro/secondstoryjs-router

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SS.Router

The Secondstory router class uses jquery/controller/history to listen to the location change events, then it matches against the Routes you have setup and finally sends a new OpenAjax event containing the value of the .to() method you setup when definition the route. It also contains logic for making sure multiple events aren't published for the same location if a user clicks the same link twice, for example.

So let's go back to our project configuration file:

steal.plugins("ss/router")
     .then(function($) {

  Router.add("/articles/:article_name").to("project_article");
});

That's it! When #/articles/my-first-article is accessed, OpenAjax will publish a project_article event with "my-first-article" as the "article_name" parameter.

About

Sherpa-based router

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%