Created
January 25, 2014 03:34
-
-
Save adoc/8611448 to your computer and use it in GitHub Desktop.
wrapper.js: Convenient JS Package wrapping that also will hook require.js if present.
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
/* | |
Convenient JS Package wrapping that also will hook require.js if present. | |
*/ | |
(function(window) { | |
// Your package goes here. | |
var MyPackage = {}; | |
// Set global object. | |
window.MyPackage = MyPackage; | |
// AMD Hook | |
if (typeof define === "function" && define.amd) { | |
define( "mypackage", ['jquery', 'underscore'], function () { | |
return MyPackage; | |
}); | |
} | |
}).call(window, this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment