0

My electron application has a problem.Sometimes those callback didn't print at dev tool's console while setTimeout works well.

setImmediate(()=>{
   console.log("setImmediate")
})
process.nextTick(()=>{
   console.log("nextTick")
})

I read documents about event loop,feel so confused,because if setTimeout can work,means the event loop is alive.And according to the documents,callbacks added by process.nextTick will execute when the event loop begin next iteration. And setImmediate() should work in the event loop,too.

KayWang
  • 71
  • 6
  • There's a big difference between *"...callback added by Process.nextTick() and setImmediate() not executed..."* and *"...those callback didn't print at dev tool's console..."* (by which I suspect you really mean, "I didn't see their output in the devtools console," which again is yet another different thing). What efforts have you made to debug this? To use some other means of seeing whether they ran? – T.J. Crowder Jul 15 '21 at 07:32
  • @T.J.Crowder console.log printed when it was added by setTimeout.that's why I think the callback was not executed .This bug was reported by my colleague,and I didn't reproduce it yet. – KayWang Jul 15 '21 at 09:07

0 Answers0