How to create an auto-updating javascript template?
<p>I am creating a web application based on data using javascript. This data is stored as a js object and is constantly being updated using AJAX. The object has some methods to reorganize the data, such as sorting and filtering, as well as a method called <code>render()</code> which uses js templating to update the html to represent the data.</p>

<p>What I want is that every time the data object changes it automatically calls the render method to update the view. I know this can be done by just calling <code>render()</code> inside all my methods that modify the data, but I am looking for a cleaner way to do it.</p>

<p>I have read something about the observer pattern however I am not familiar with it and I don't know if I can use that to achieve this. Also I know about the Object.watch() method but that is not supported by all browsers so I can't use it.</p>

<p>Do you have any suggestions or examples about how can I do this?</p>

<p>Thanks.</p>
