You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

hydrajs-router-plugin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydrajs-router-plugin

Hydra.js plugin to execute the specified callback when the url changes.

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created
Source

hydrajs-router-plugin

Is a plugin to execute the specified callback when the url changes.

Update to version 1.0.0

Build Status

Changelog

Install

Install with Bower

bower install hydrajs-router-plugin

Install with Component

component install hydrajs-router-plugin

Install with NPM

npm install hydrajs-router-plugin

Use in browser

Insert in your html code:

<script type="text/javascript" src="hydra.js"></script
<script type="text/javascript" src="hydrajs-router-plugin.js"></script>

Use with requirejs

Insert in your code:

define(['hydrajs-router-plugin'], function () {
    // code here.
});

How it works

The router looks for the id of the body and executes a callback if this id matches any of the added routes.

Common usage

hydrajs-router-plugin extends Hydra.js library adding new methods.

Hydra.router.add

This method adds a new route to execute when the url changes.

Hydra.router.add( sIdBody, fpCallback );

Hydra.router.setDefault

This methd adds a default callback to execute if there is no route assigned to the current id.

Hydra.router.setDefault( fpDefaultCallback );

API

Hydra.router

add - Params [String - body id, Function - callback to execute on load the page]

setDefault - Params [Function - callback to be executed when the id of the body does nott match any route]

License

hydrajs-router-plugin is licensed under MIT license. (see LICENSE file)

Keywords

hydra

FAQs

Package last updated on 02 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts