Skip to content

Instantly share code, notes, and snippets.

@nuweb
Created June 16, 2015 14:28
Show Gist options
  • Save nuweb/3bc10ee9b1ffe392c7e8 to your computer and use it in GitHub Desktop.
Save nuweb/3bc10ee9b1ffe392c7e8 to your computer and use it in GitHub Desktop.
A barebones UMD implementation
// A barebones UMD implementation
;(function(){
"use strict";
var myObj = {};
myObj.property = "prop";
myObj.method = function method() {};
// normalize for different environments
if (typeof define === "function" && define.amd) {
define(function() { return myObj; });
} else if (module && module.exports) {
module.exports = myObj;
} else {
self = myObj;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment