I have to perform some action after all the processes that were pushed in the queue have been executed completely. I have a function which is creating a div element.This function is queued using mathjax queue.Suppose wrap is an element created in this function.Now i am returning wrap.innerHTML from outside the function.What is happening here is that the control is reaching return wrap.innerHTML statement before the process queued for creation of this element is complete.
You will not be able to return wrap.innerHTML
from the function that performs the QUEUE.Push()
, since wrap
isn't created until the queued function runs, and that may not be until later. Whatever needs to use wrap.innerHTML
will have to run as a callback instead. You could call it from the function that has been Pushed()
, or Push()
the callback onto the queue so that it runs after that function is finished.