Skip to content

Instantly share code, notes, and snippets.

@Richienb
Created March 17, 2019 11:18
Show Gist options
  • Save Richienb/9a4bf7c73317038fd356ea063d3fc9a2 to your computer and use it in GitHub Desktop.
Save Richienb/9a4bf7c73317038fd356ea063d3fc9a2 to your computer and use it in GitHub Desktop.
UMD Example
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory();
} else {
root.returnExports = factory();
}
}(typeof self !== 'undefined' ? self : this, function () {
// START OF YOUR CODE
const helloWorld = () => {
return "Hello World!"
}
return helloWorld;
// END OF YOUR CODE
}));
((root, factory) => {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory();
} else {
root.returnExports = factory();
}
})(typeof self !== 'undefined' ? self : this, () => {
// START OF YOUR CODE
const helloWorld = () => {
return "Hello World!"
}
return helloWorld;
// END OF YOUR CODE
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment