setInterval(..., 0) can be used to provide control over the browser user interface to prevent it from freezing if your code takes a long time.
In this case, that.publish will exit almost immediately before executing any callback. Then each callback will be launched "in the background" - they will be placed in the event loop, and each of them will allow the browser to do this before the next callback is made.
This seems like a good idea when handling events, because you do not want event processing to block the browser, even if there are many, or some of them take a lot of time.
About documentation - as indicated, incorrect. Javascript is single threaded. But if you called publish() several times in a row, it is true that all calls will be completed before any callbacks are made, due to setTimeout . Perhaps this is what the documentation means?
source share