aboutsummaryrefslogtreecommitdiff
path: root/test/js/web/timers/setTimeout-unref-fixture.js
blob: 97a0f78a2f404732cfdb0294ba0690d9821e8502 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
const timer = setTimeout(() => {}, 999_999_999);
if (timer.unref() !== timer) throw new Error("Expected timer.unref() === timer");

var ranCount = 0;
const going2Refresh = setTimeout(() => {
  if (ranCount < 1) going2Refresh.refresh();
  ranCount++;

  if (ranCount === 2) {
    console.log("SUCCESS");
  }
}, 1);