jquery插件定义函数

//jQuery 应用扩展
jQuery.extend({
bar:function () {
//方法实现
}
});
调用方法:$.bar();

(function($) {
$.fn.foo = function(opts) {
default = {}
opts = $.extend({}, default, opts);
var bar = function(x){}
return this.each(function() {
bar(x); //如果我想在这里调用bar函数,该怎么在插件内部定义这个函数
});
}
})(jQuery);