Skip to content

Instantly share code, notes, and snippets.

@deavial
Created October 4, 2021 20:23
Show Gist options
  • Save deavial/21f6b31ac5296fd2ccfdbebdc9890047 to your computer and use it in GitHub Desktop.
Save deavial/21f6b31ac5296fd2ccfdbebdc9890047 to your computer and use it in GitHub Desktop.
umd template
(function (root, factory) {
var name = "FooMod";
var deps = ["this", "that", "whatnot"];
if (typeof exports === "object") {
module.exports = factory.apply(undefined, deps.map(function (d) { return require(d); }));
} else if (typeof define === "function" && define.amd) {
define(deps, factory);
} else {
root[name] = factory.apply(undefined, map(deps, function (d) { return root[d]; }));
}
}(this, function Factory(This, That, Whatnot) {
var FooMod = {}
return FooMod;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment