Answer the question
In order to leave comments, you need to log in
How to make an asynchronous wrapper for a synchronous library?
There is someone else's Javascript library. She is synchronous. That is, by calling its a() function, you need to wait (sometimes for a long time) for its return. I would like to make an asynchronous cropper over this library. Those. so that I call the wrapper.a (func) method, which immediately returns, somewhere in parallel by running the a () function. Then, when a() is executed, my func handler will be called.
What is the easiest/correct way to do this? So far, only timers come to mind, but I'm generally new to Javascript - maybe there is something smarter?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question