Skip to content

Instantly share code, notes, and snippets.

@busticated
Forked from jrburke/basic.js
Created November 8, 2011 17:14
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 busticated/1348409 to your computer and use it in GitHub Desktop.
Save busticated/1348409 to your computer and use it in GitHub Desktop.
possible jquery plugin boilerplate
(function(root, factory) {
if (typeof exports === 'object') {
// Node/CommonJS
factory(require('jquery'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Use a named plugin in case this
// file is loaded outside an AMD loader,
// but an AMD loader lives on the page.
define('myPlugin', ['jquery'], factory);
} else {
// Browser globals
factory(root.jQuery);
}
})(this, function($) {
$.fn.myPlugin = function () {};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment