0

Te following code is fine:

var Pill = (function() {

    var hideCheckPricesPill = function() {
        $(HB.pillSearchBar.checkPrices).hide();
    };

    var hideAnyPill = function(pill) {
        $(pill).hide();
    };

    var displaySearchBar = function() {
        $("." + HB.pillSearchBar.hideSearchForm).removeClass(HB.pillSearchBar.hideSearchForm);
    };

    var isEditSearchPill = function(pill) {
        if(pill === HB.pillSearchBar.editSearchText) {
            hideCheckPricesPill();
        }
        else {
            hideAnyPill(pill);
        }
    };

    var isMobileSearch = function(pill) {
        if(!$(pill).hasClass(HB.pillSearchBar.jsOpenMobileSearch)){
            isEditSearchPill(pill);
            displaySearchBar();
        }
    };

    var addEventListenerOnPill = function(pill) {
        $(pill).on('click', 'a',  function() {
            isMobileSearch(pill);
        });
    };

    return {
        addEventListenerOnPill: addEventListenerOnPill
    }

})();

Is there a way to add a prototype functionality to one of the public functions so that it can be returned and initialized with the "new" key word?

Aessandro
  • 5,517
  • 21
  • 66
  • 139

0 Answers0