In the context of the browser, is it safe to say that the only possible link between a web API binding (eg: setTimeout()
) and the Javascript engine is via a callback function?
ie: callback function -> callback queue -> event loop -> Javascript engine
Or are there other mechanisms that could be used by some native code to communicate back with the Javascript engine?
Are callbacks the only way a web API binding is linked with the JavaScript engine?
No. document.createElement
is one of many counter-examples.
Are callbacks the only way an asynchronous web API binding is linked back to the Javascript engine?
Yes. Callbacks are the only way any asynchronous API works, that's pretty much the definition of "asynchronous API". (Not just in JavaScript or on the web.)