Created
November 29, 2013 05:34
-
-
Save jjasonclark/7701980 to your computer and use it in GitHub Desktop.
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($, window, document, undefined) { | |
var pluginName = "name me": | |
$.fn[pluginName] = function (method) { | |
var dataName = "plugin_" + pluginName; | |
return this.each(function() { | |
var localData = $.data(this, dataName); | |
if (undefined === $.data(this, dataName)) { | |
var options = $.extend({}, $.fn[pluginName]["defaults"], method); | |
$.data(this, dataName, plugin(this, options)); | |
} else { | |
localData.methods[method](); | |
}; | |
}); | |
}; | |
$.fn[pluginName]["defaults"] = { | |
}; | |
function plugin(element, settings) { | |
var private_vars = "here"; | |
function private_functions_here() { | |
}; | |
return { | |
methods: { | |
public_function: private_functions_here | |
} | |
}; | |
}; | |
})(jQuery, window, document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment