Created
February 17, 2014 00:29
-
-
Save KoryNunn/9042690 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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