✅ – ✅ – Sourdface – 05-35 Jun 9

I have a style/linting question
S
Sourdface314d ago
standard.js is telling me I shouldn't use "new Promise()" for side effects because I'm not assigning or returning it. The goal is to get the work to be performed outside of the event currently being processed by the js engine's main event loop What is the actual issue here, and what should I be doing instead? Oh. Well ok, I thought that the executor function didn't run until the current event had completed, but apparently it runs in the same stack as the caller. So using Promise in this way won't give me the desired effect. It looks like what I want is setTimeout(() => { /* code */ }, 0)
UU
Unknown User313d ago