Javascript setInterval not working

Why does setInterval not work in a touch bar trigger of type Javascript? I just want to make something wait, or actually, update the text every x seconds. Could someone help me with this please? I can't get it to work.

((async () => {

    setInterval(() => {
        counter++;
        callBTT('update_trigger', {uuid: 'B9886C5B-0835-438E-A51E-A62850283C2A', json: JSON.stringify({"BTTTouchBarButtonName" : "Number: " + counter}) });
    }, 1000);

    returnToBTT('Done');

}))();

unfortunately setInterval is not part of the JavaScriptCore. However in the latest alpha I have manually polyfilled it. I’m not sure whether it would work for this use case though.

While famously known as “ JavaScript Timers”, functions like setTimeout and setInterval are not part of the ECMAScript specs or any JavaScript engine implementations

What exactly do you want to do? Maybe the BTT time based triggers (in the other triggers section) can help?

Ah ok I understand. I would like to get two things right (although both don't need to be answered in this question):

  • A "looper" method of sorts
  • Call an HTTP call

I want to write a touch bar widget that updates its text based on the response of a HTTP call. And it need to call this HTTP call every minute or so to check for any changes. Could you maybe link me to docs or other questions that could help me solve this problem?

By the way! Thanks for BetterTouchTools. I just started the trail today and will surely look at buying it.

NOTE: Maybe display some time of "setInterval is not supported" message or something in the Run Test result or so? I battling a long time because I thought my code was wrong.