jQuery拡張機能のメソッド間でデータを共有する方法を知りたいので、メソッドを呼び出すと、で定義されたおよび変数refreshを使用できます。pluginoptionsinit
ページごとにこれらのコントロールが複数あります。
これが私が持っているものの例です:
(function($) {
    var methods = {
        init: function(options) {
            var defaults = {
                defaultText: "Rating",
                maxRating: 5,
            };
            options = $.extend(defaults, options);
            return this.each(function() {
                var plugin = $(this);
                main($(plugin), options);
            });
        },
        refresh: function() {
            // I would like to be able to use the 'options' and 'plugin' variables defined in the init method
        }
    };
    function main(plugin, option) {
        // do main code stuff
    }
}(jQuery));