Synchronously run renderer.setAnimationLoop

So I haven’t written any code, also I am new to three.js and this is just a discussion, of an idea in my mind, but suppose:

renderer.setAnimationLoop(function () {

Say I have some operations in the animation loop, how do i make sure that Hi gets printed only after the operations in setAnimationLoop are done? In the sense it should run synchronously. I will have some bool variable to keep track of whether the operations are done in setAnimationLoop.

Well, you put console.log("Hi"); and the very end of the callback.

This won’t work since you don’t know when the variable will be set.