Does the window.requestAnimationFrame
function create new threads to let the function where it's called and the function itself run parallel? Because I don't understand why the following code, doesn't result in a stack overflow.
window.requestAnimationFrame
calls main
and main
calls window.requestAnimationFrame
and so on ...
w.rAF
-> main
-> w.rAF
-> main
-> w.rAF
. . .
main.js
function main(currentTime){
window.requestAnimationFrame(main);
console.log(currentTime);
}
window.requestAnimationFrame(main);
index.html
<script src="main.js"></script>