Skip to content

Instantly share code, notes, and snippets.

@Joopmicroop
Last active August 12, 2016 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Joopmicroop/0086b7b2c550cf10feb8ae49f01f519e to your computer and use it in GitHub Desktop.
Save Joopmicroop/0086b7b2c550cf10feb8ae49f01f519e to your computer and use it in GitHub Desktop.
write modules compatible for amd require/exports or root/window
(function (root, factory) {
if (typeof define === "function" && define.amd) define(factory); // amd
else if(typeof module == 'object') module.exports = factory(); // node require
else if(typeof exports == 'object') exports = factory(); // browserify
else root.ResizeSensor = factory(); // root/window
})(this, function () {
// code here
// return foo;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment