Bricks accordion JS for facetwp-loaded

<?php
/** Reloads bricks accordion after FacetWP refresh **/
add_action( 'facetwp_scripts', function() {
  ?>
  <script>
    document.addEventListener('facetwp-loaded', function() {
      if( FWP.loaded ) {
        bricksAccordion();
      }
    });
  </script>
  <?php
}, 100 );