Skip to content

Instantly share code, notes, and snippets.

@KoryNunn
Created February 17, 2014 00:29
Show Gist options
  • Select an option

  • Save KoryNunn/9042690 to your computer and use it in GitHub Desktop.

Select an option

Save KoryNunn/9042690 to your computer and use it in GitHub Desktop.
// Module A does events
module.exports = function DoEventStuff(){
/*
Do DOM event things like A.on('event')
Stores info about bindings in an array.
*/
}
// Module B needs events
module.exports = function(){
var events = require('a');
events.on('bla');
}
// Module C needs events
module.exports = function(){
var events = require('a');
events.on('bla');
}
Both module B and module C should be able to bind events, and these events need to know about each other.
Module C does not know Module B exists
The top level module that requires B and C, does not know about module A, nor does it need to, and as such, I'd rather not require('a') just so it can pass it to both B and C.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment