facetwp check FWP in js

<script>
(function($) {
    $(function() {    
        if ( 'undefined' !== typeof FWP ) {
          // Make checkbox options semi-transparent
          FWP.loading_handler = function(params) {
              params.element.find('.facetwp-checkbox').css('opacity', 0.5);
          }
        }
    });
})(jQuery);
</script>