@if ($poorMansCron && $loggedIn)
    <script>

        jQuery(document).ready(function() {

            let now = Date.now();
            let lastCronExecution = localStorage.getItem("lastCronRun");

            if(Number.isInteger(lastCronExecution)){

                var difference = Math.floor((now - lastCronExecution) / 1000);
                if(difference > 300) {
                    jQuery.get('{!! BASE_URL !!}/cron/run');
                    localStorage.setItem("lastCronRun", Date.now());
                }

            }else{
                jQuery.get('{!! BASE_URL !!}/cron/run');
                localStorage.setItem("lastCronRun", Date.now());
            }

            //1 min time to run cron
            setInterval(function(){
                jQuery.get('{!! BASE_URL !!}/cron/run');
                localStorage.setItem("lastCronRun", Date.now());
            }, 300000);
        });

    </script>
@endif

<script src="{!! BASE_URL !!}/dist/js/compiled-footer.{!! $version !!}.min.js"></script>

@dispatchEvent('beforeBodyClose')
