Created
September 25, 2012 19:03
-
-
Save mstrickland22/3783782 to your computer and use it in GitHub Desktop.
JavaScript: AMD jQuery Plugin Wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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