flight-proxy
A Flight component for triggering a target event when a source event occurs. Event data is also proxied from source to target.
Installation
bower install --save flight-proxy
Example
define(['flight-proxy'], function(EventProxy) {
var sourceEvent = 'source-event-name';
var targetEvent = 'target-event-name';
var data = {"foo": 123};
EventProxy.attachTo(document, {
source: sourceEvent,
target: targetEvent
});
// Listen for proxied event
$(document).on(targetEvent, function(e, proxiedData) {
console.log(e, proxiedData);
});
// Manually trigger a source event
$(document).trigger(sourceEvent, data);
});
Development
Development of this component requires Bower, and preferably Karma to be globally installed:
npm install -g bower karma
Then install the Node.js and client-side dependencies by running the following commands in the repo's root directory.
npm install
bower install
To continuously run the tests in Chrome and Firefox during development, just run:
karma start
Contributing to this project
Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.