Skip to content

Instantly share code, notes, and snippets.

@akisaarinen
Forked from hhulkko/gist:845141
Created February 26, 2011 17:16
Show Gist options
  • Save akisaarinen/845397 to your computer and use it in GitHub Desktop.
Save akisaarinen/845397 to your computer and use it in GitHub Desktop.
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