Skip to content

Instantly share code, notes, and snippets.

@mostlyfine
Created December 7, 2011 07:10
Show Gist options
  • Select an option

  • Save mostlyfine/1441818 to your computer and use it in GitHub Desktop.

Select an option

Save mostlyfine/1441818 to your computer and use it in GitHub Desktop.
プラグイン内のpublic method、protected attribute
//
// plugin呼び出し
//
$(function() {
$.sample2.hello("world");
});
//
// plugin本体
//
(function($) {
var name_space = "sample2";
$[name_space] = function(options) {
// ...
return this;
};
var public_msg = "this is sample2";
$.extend($[name_space], {
hello: function(msg) {
if(window.console && window.console.log) {
window.console.log(public_msg);
window.console.log(msg);
}
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment