Why does setTimeout in a Custom Pixel floor the duration at 1 second?

Why does setTimeout in a Custom Pixel floor the duration at 1 second?

vnierenberg
Shopify Partner
4 0 0

It seems that `setTimeout` in the "lax mode" environment provided for Custom PIxels is altered to floor the duration at around 1 second. The following code:

 

void function heartbeat() {
  console.time()
  setTimeout(() => {
    console.timeEnd()
    heartbeat()
  })  
}()

results in the following logs:

image (2).png
Is this behavior intentional? And if so, why?
Replies 0 (0)