I'm creating a plugin in js and need to add some methods to this plugin.
This is the base 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 the use of 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();