Live scores

Is possible to show live scores?

You can use a setInterval() or setTimeout() (like shown below) function to ’ fetch ’ scores every 15 seconds or so.

setInterval()
(I guess)

You’re absolutely right. It should be setInterval() but setTimeout() may also be used like this

$w.onReady(function () {
    firstCount();
});

function firstCount() {
    countActive();
}

function countActive() {
    wixData.query('JobsDB')
    .not(
    wixData.query("JobsDB")
      .eq("claimStatus", "CLAIMED")
    )
    .find()
    .then((results) => {
        let items = results.totalCount;
        $w("#activeJobs").text = String(items);
        countLoop();
    });
}

function countLoop() {
    setTimeout(() => {
        countActive();
    }, 7000);
}

I believe setTimeout() like shown above will help during those shorter refresh periods where you want to actually finish the first api call before calling it again. In setInterval() if the time period is shorter and the page makes a call to an api, the next call may be made while the 1st one is not yet completed.

Although setInterval() makes more sense for more conventional needs.

Thanks for rectifying it!