Created
November 19, 2015 20:24
-
-
Save guillermoroblesjr/42b6b73c1322d651fc7f to your computer and use it in GitHub Desktop.
jQuery AMD compatible plugin template
This file contains hidden or 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
(function(scope, undefined){ | |
var factory = function($){ | |
$.fn.pluginName = function() {}; | |
}; | |
// Set in scope if jquery is already there | |
if (scope.jQuery !== undefined || scope.$ !== undefined) { | |
factory(scope.jQuery || scope.$); | |
} | |
// AMD. Register as an anonymous module. | |
else if (typeof scope.define === 'function' && scope.define.amd) { | |
scope.define(['jquery'], factory); | |
} | |
// Browser globals | |
else { | |
factory(scope.jQuery || scope.$); | |
} | |
})(this || window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment