summaryrefslogtreecommitdiff
path: root/cli/tests/tla3/timeout_loop.js
blob: 860e6cd2ae718ed115d5bfa96c7e773425fb69f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export const foo = "foo";

export function delay(ms) {
  return new Promise((res) =>
    setTimeout(() => {
      res();
    }, ms)
  );
}

let i = 0;

async function timeoutLoop() {
  await delay(1000);
  console.log("timeout loop", i);
  i++;
  if (i > 5) {
    return;
  }
  timeoutLoop();
}

timeoutLoop();