Is a plugin to maintain backward compatibility with, Hydra.js, lower version than 2.8.0.
Install with Bower
bower install hydrajs-sandbox-plugin
Install with Component
component install hydrajs-sandbox-plugin
Install with NPM
npm install hydrajs-sandbox-plugin
Insert in your html code:
<script type="text/javascript" src="hydra.js"></script
<script type="text/javascript" src="hydrajs-sandbox-plugin.js"></script>
Insert in your code:
define(['hydrajs-sandbox-plugin'], function () {
// code here.
});
It should be used to manage global events, and this plugin is needed to maintain compatibility with previous version to 2.8.0 of Hydra when the new Bus object has been implemented.
hydrajs-sandbox-plugin extends Hydra.js library adding new methods.
Using this method your code will start listening events.
new Hydra.action().listen( ['eventType'], callback, module );
Using this method your code will trigger the specified event.
new Hydra.action().notify( { type: 'eventType', data: {} } );
Using this method you code will stop listening events.
new Hydra.action().stopListen( ['eventType'], module );
Hydra.action is a constructor that creates the sandbox to manage events and it should be created using new.
listen - Params [Array - event names, Function - callback to execute when the event is triggered, Object - The context to execute the callback ]
stopListen - Params: [Array - event names, Object - context object where the event is being listened]
hydrajs-sandbox-plugin is licensed under MIT license. (see LICENSE file)