-
-
Save akisaarinen/845397 to your computer and use it in GitHub Desktop.
This file contains 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
function importModule(target, module) { | |
for (var method in module) | |
target[method] = module[method] | |
} | |
BASE = (function() { | |
var exports = { | |
getFoo: function() { return 'foo' } | |
} | |
return exports | |
})() | |
FOO = (function() { | |
importModule(this, BASE) | |
var exports = { | |
logFoo: function(x) { console.log(getFoo()) } | |
} | |
return exports | |
})() | |
importModule(window, FOO) | |
logFoo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment