2
I am creating a plugin in js and need to add some methods to this plugin.
This is the basis of the plugin so far:
    (function ($) {
    function jarbas(params) {
        ...
    }
    $.fn.jarbas = function (params) {
        // cria funcionalidade a partir do método sem seletor $.jarbas(params);
    }
    // defaults
    $.fn.jarbas.defaults = { ... };
    $.extend({
        jarbas : function (params) {
            switch (typeof params) {
                case 'string':
                    break;
                case 'object':
                    return new jarbas(params);
                    break;
            }
        }
    });
})(jQuery);
In using the plugin I do (works perfect):
$.jarbas({ ... });
$('seletor').jarbas({ ... });
is it possible to create methods extending the plugin name without the need for selector? for example:
$.jarbas.remapAll();
Yes, that’s possible, but this is
.remapAll(): how would you know what to do if you pass no argument or selector?– Sergio
as long as I can call the method!
– Trxplz0