A Flight mixin for sharing named resources between components. A component can provide a resource into a central registry which other components can subsequently request. On component teardown any provided resources are removed.
bower install --save flight-with-resources
Here's an example of two component definitions that use withResources
.
function providingComponent() {
this.after('initialize', function () {
this.provideResource('appManifest', {
versionNo: '1.0.1',
buildNo: '1234',
url: 'https://tweetdeck.twitter.com'
});
});
}
function requestingComponent() {
this.after('initialize', function () {
var versionNo = this.requestResource('appManifest').versionNo;
});
}
provideResources
, takes the name of the resource that is being provided, and then the resource itself. The resource can be any JavaScript type, including a function.
requestResource
takes the name of the resource being requested and returns the requested resource.
removeResource
takes the name of a resource to be removed.
Development of this component requires Bower to be globally installed:
npm install -g bower
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 during development, just run:
npm run watch-test
Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.