Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (46 sloc) 1.49 KB

API Reference

$frn

$frn( path, fn ) .add( path, fn )
Add a rule to the chain. fn will be executed if the path string partially or completely matches the remaining location.

$frn( RegExp, fn ) .add( RegExp, fn )
Add a rule to the chain. fn will be executed if the RegExp partially or completely matches the remaining location.

$frn( RuleArray ) .add( RuleArray )
Add several rules to the chain.

.location( path )
Set the path to use for rule matching.

.location( )
Get the remaining unmatched path.

.data( key, value )
Store arbitrary data identified by a key string.

.data( key )
Retrieve previously stored data identified by a key string.

.data( )
Retrieve all previously stored data as an object, key: value.

.queue([String])
Start queueing rules for execution later. Pass an optional string identifier to create a custom queue.

.done( )
Stop queueing.

.clear([String])
Clear all rules from the queue. Pass a string to clear a custom queue.

.dispatch([String])
Dispatch the queue. Pass a string to dispatch a custom queue.

RuleArray
A nested array literal

[
  ['path', function(){}],
  [/path/, function(){}]
];

Example usage:

$frn('/videos', function(){
    this.add('/view /edit', function(data){
        alert(data.title);
    });
})

$frn.queue('Special')
  .add('/', function(){
    alert('See this when dispatching a custom queue'); 
  })
  .done();
Jump to Line
Something went wrong with that request. Please try again.