Is a plugin to execute the specified callback when the url changes.
Install with Bower
bower install hydrajs-router-plugin
Install with Component
component install hydrajs-router-plugin
Install with NPM
npm install hydrajs-router-plugin
Insert in your html code:
<script type="text/javascript" src="hydra.js"></script
<script type="text/javascript" src="hydrajs-router-plugin.js"></script>
Insert in your code:
define(['hydrajs-router-plugin'], function () {
// code here.
});
The router looks for the id of the body and executes a callback if this id matches any of the added routes.
hydrajs-router-plugin extends Hydra.js library adding new methods.
This method adds a new route to execute when the url changes.
Hydra.router.add( sIdBody, fpCallback );
This methd adds a default callback to execute if there is no route assigned to the current id.
Hydra.router.setDefault( fpDefaultCallback );
setDefault - Params [Function - callback to be executed when the id of the body does nott match any route]
hydrajs-router-plugin is licensed under MIT license. (see LICENSE file)