Created
June 16, 2015 14:28
-
-
Save nuweb/3bc10ee9b1ffe392c7e8 to your computer and use it in GitHub Desktop.
A barebones UMD implementation
This file contains hidden or 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
// 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