Skip to content

Instantly share code, notes, and snippets.

@raineorshine
Created August 14, 2014 04:00
Show Gist options
  • Save raineorshine/e4f79950867eea05e3c1 to your computer and use it in GitHub Desktop.
Save raineorshine/e4f79950867eea05e3c1 to your computer and use it in GitHub Desktop.
Universal Module Definition Pattern (from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp.umd.js)
/* global define:true module:true window: true */
if (typeof define === 'function' && define.amd) {
define(function() { return MYMODULE; });
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = MYMODULE;
} else if (typeof this !== 'undefined') {
this['RSVP'] = MYMODULE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment