Skip to content

Instantly share code, notes, and snippets.

@mstrickland22
Created September 25, 2012 19:03
Show Gist options
  • Save mstrickland22/3783782 to your computer and use it in GitHub Desktop.
Save mstrickland22/3783782 to your computer and use it in GitHub Desktop.
JavaScript: AMD jQuery Plugin Wrapper
// Uses AMD or browser globals to create a jQuery plugin.
// It does not try to register in a CommonJS environment since
// jQuery is not likely to run in those environments.
// See jqueryPluginCommonJs.js for that version.
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
$.fn.jqueryPlugin = function () {};
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment