Last active
December 18, 2015 22:08
-
-
Save bspingarn/5852127 to your computer and use it in GitHub Desktop.
A simple function for returning RequireJS modules and namespacing them onto the window object for further interaction.
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 exposeMod(moduleName){ | |
var reqObject = require(moduleName); | |
if (moduleName.indexOf('/') ) { | |
moduleNameArray = moduleName.split('/'); | |
window[moduleNameArray[moduleNameArray.length-1]] = reqObject; | |
} | |
else { | |
window[moduleName] = reqObject; | |
} | |
return reqObject; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment