I have a jQuery plugin I created for my needs. Now all functions are in global namespace which isn’t good, I would like to move them to hoo.account
namespace.
Here how my code looks right now:
(($) => {
$.fn.toggleActive = function(active) {
this.toggleClass("active", active);
this.children(".data__form-activator").toggle(!active);
this.children(".data__form-btn").toggleClass("visible", active);
this.children(".data__flex-row").toggleClass("_m-none", !active);
this.find("input, select").prop("disabled", !active);
return this;
};
$.fn.activate = function() {
return this.toggleActive(true);
};
$.fn.deactivate = function() {
return this.toggleActive(false);
};
})(jQuery);
Now I’m calling $(...).activate()
, but I wanna call it $(...)hoo.account.activate()
.
Thanks in advance!