Is there a JsRender event or callback to determine when a render method has completed? I’m wanting to process a number of templates and ensure that they’ve all completed before I grab the resulting document element. Are all render method run synchronously?
Share
jsRender renders templates synchronously, there is no callback function, the
.render()function just returns the rendered data.When you do have multiple asynchronous processes (such as ajax calls that return data that you then render with jsRender), and you need all of them to complete before performing some action, you can use jQuery’s Deferred objects. Look into .when() for how to do that.