Disable popstate listener temporarily

<script>
(function($) {
    FWP.hooks.addAction('facetwp/ready', function() {

        // remove the popstate listener
        $(window).off('popstate');

        // add it back after 10 seconds
        window.setTimeout(function() {
            $(window).on('popstate', function() {

                // Detect browser "back-foward" cache
                if (FWP.is_bfcache) {
                    FWP.loaded = false;
                }

                if ((FWP.loaded || FWP.is_bfcache) && ! FWP.is_refresh) {
                    FWP.is_popstate = true;
                    FWP.refresh();
                    FWP.is_popstate = false;
                }
            });
        }, 10000 );
    });
})(jQuery);
</script>