leonidas / transparency

Transparency is a semantic template engine for the browser. It maps JSON objects to DOM elements by id, class and data-bind attributes.
http://leonidas.github.com/transparency/
MIT License
969 stars 112 forks source link

Callback when render completed #75

Closed hakoniemi closed 12 years ago

hakoniemi commented 12 years ago

It'd be good to have a possibility to provide a callback function to .render() which would be executed after rendering is completed.

Now, eg. adding an iScroll to the list which is populated through render() doesn't always get correct height since the rendering isn't fully completed.

pyykkis commented 12 years ago

I'm just heading to vacation and offline for a week. Could you provide a fiddle showing the problem? The feature should be easy to implement, feel free to make a pull req, in case you have time

pyykkis commented 12 years ago

D'oh, I finally gave this a bit of thought.

.render() is a synchronous function, so there's no need for callbacks. Just use plain ol' imperative style

template.render({foo: "bar"});
myPostProcessingFunction();