Skip to content

Instantly share code, notes, and snippets.

@scottcorgan
Last active December 16, 2015 16:19
Show Gist options
  • Save scottcorgan/5462127 to your computer and use it in GitHub Desktop.
Save scottcorgan/5462127 to your computer and use it in GitHub Desktop.
// Module definition
// inject <~~ that's how you declare a module file injectable for Injector
exports.YourModule = function () {
return function () {
console.log('in my injectable module');
};
};
///////////////////////////////////////////////////////////
// Somewhere else in your codebase, another module
// inject
exports.AnotherModule = function (YourModule) { // <~~ The magic happens right there
YourModule(); // <~~ outputs "in my injectable module"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment