71104 / jquery-handlebars

A jQuery plugin to render Handlebars.js templates into elements
http://71104.github.io/jquery-handlebars
MIT License
100 stars 39 forks source link

Added render callback argument #15

Open shamasis opened 9 years ago

shamasis commented 9 years ago

This PR modifies the $.fn.render function to add a third callback argument. When a function is passed as the third argument, the function is executed in the rendered element's context upon successful application of the template. This is useful in chaining template loads.

The $.when( /* ... */ ).done() can also be used to arrive to the desired effect, but this is more intuitive for beginners and for rapid prototyping with lesser codes.

Lint checked and README updated.

shamasis commented 7 years ago

Ah. Its late, but I did some changes to use $.when if callback was available. @frkr