Appcelerator Routes
/**
* Routes.js provides a single function that allows
* mapping from subpage transitions
* onto Appcelerator Messages.
*
*
*
* A typical usage looks like the following:
*
* routes({
* '#home' : 'l:show.home',
* '#kittens' : 'l:show.kittens',
* '#puppies' : 'l:show.puppies',
* '#kitten/:id' : 'l:show.animal[type=cat,id=#{id}]',
* '#puppy/:id' : 'l:show.animal[type=dog,id=#{id}]',
* '#kitten/:id/friends' : 'l:show.friends[type=cat,id=#{id}]',
* '#puppy/:id/friends' : 'l:show.friends[type=dog,id=#{id}]',
* '#yaps/:fromid/:toid' : 'l:show.messages[dogid=#{fromid},catid=#{toid}]',
* '#hisses/:fromid/:toid' : 'l:show.messages[catid=#{fromid},dogid=#{toid}]',
* });
*
* Using this routes definition,
* the app author can create links to subpages,
* and respond to these link clicks based on the messages on the right-hand-side.
*
* For example, this link:
* <a href="#kitten/312/friends">Whisker's Friends</a>
* will send the message:
* l:show.friends[type=cat,id=312]
*
* Like other Appcelerator history change listeners,
* the messages connected by routes will be fired when the user
* 1) clicks a link
* 2) navigates forward and backward
* 3) follows a link from another page which includes the hash
*
* Syntax is borrowed from Ruby on Rails routing:
* http://manuals.rubyonrails.com/read/chapter/65
* and from Appcelerator string interpolation/templates:
* http://doc.appcelerator.org/reference/interpolation/index.html
*
* Version 0.1, by Mark Luffel
* Released under GPL version 3
*/
Further: