Created
April 2, 2013 06:45
-
-
Save teaholiday89/5290365 to your computer and use it in GitHub Desktop.
jQuery Plugin Boilerplate
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
| <snippet> | |
| <content><![CDATA[ | |
| /* | |
| * jQuery ${1:plugin} Plugin | |
| * | |
| * ${2:Description} | |
| * | |
| */ | |
| ;(function(\$, window, undefined) { | |
| var defaults = { | |
| ${0} | |
| } | |
| var methods = { | |
| } | |
| \$.${1} = function(method, options) { | |
| var options = \$.extend({}, defaults, options); | |
| if (methods[method]) { | |
| return methods[method].apply(null, options); | |
| } | |
| else if ( typeof method === 'object' ) { | |
| var settings = method; | |
| methods.init.apply(null, settings); | |
| } | |
| else { | |
| \$.error("Method " + method + " is not a defined in jQuery ${1:plugin"); | |
| } | |
| } | |
| })(jQuery, window); | |
| ]]></content> | |
| <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
| <tabTrigger>jqplugin</tabTrigger> | |
| <!-- Optional: Set a scope to limit where the snippet will trigger --> | |
| <!-- <scope>source.python</scope> --> | |
| </snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment