Skip to content

Instantly share code, notes, and snippets.

@tdharris
Created July 15, 2014 16:22
Show Gist options
  • Save tdharris/bcd8b0b597614f31fadb to your computer and use it in GitHub Desktop.
Save tdharris/bcd8b0b597614f31fadb to your computer and use it in GitHub Desktop.
// How to expose a global handler for my requestHandler to reach?
module.exports = handler = [];
exports.addToHandler = function(key, newFunction) {
handler[key] = newFunction;
}
// To handle things from my requestHandler, I'm thinking:
var handler = require('./taskHandler');
handler.addToHandler('processMail', function() {
// magic happens here...
});
handler[requestKey, params]();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment