Skip to content

Instantly share code, notes, and snippets.

@adoc
Created January 25, 2014 03:34
Show Gist options
  • Save adoc/8611448 to your computer and use it in GitHub Desktop.
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.
/*
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