Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added render callback argument #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

shamasis
Copy link

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 and others added 3 commits November 10, 2014 09:51
The goal is to be able to chain after async `ajax` operation is completed and after template has been applied.

- added a third parameter `callback` to `$.fn.render`
- checked if `callback` is a function and executed the same in scope of the selection

Since we were repeating same work in two places, moved the event trigger code to a single closured function called `applyTemplate`.
Copy link

@frkr frkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that 'plugin.js' file. Has a trigger event. How can be sure its execute asynchronous?

@shamasis
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants