pouët.net

Go to bottom

javascript flush

category: code [glöplog]
 
Is there any way in javascript to flush the command queue manually?
added on the 2018-08-23 23:55:42 by sigflup sigflup
how do you mean?
added on the 2018-08-24 00:15:39 by psenough psenough
I want a tight loop, but I don't want it hogging all the resources because code is coming into execution queue faster then it's being computed.
added on the 2018-08-24 00:22:41 by sigflup sigflup
plz no jquery
added on the 2018-08-24 02:06:16 by sigflup sigflup
is this on a browser client or on nodejs? i'm assuming it's on client side.

https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame is a nice clean way to get new call on a loop without hogging resources.

you can also offload some work to webworkers.
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers

it really depends on what you're doing exactly though.
added on the 2018-08-24 03:33:54 by psenough psenough

login

Go to top