How do I attach an event handler to mustache rendering in CouchApp using evently?
Writing a CouchApp app using evently / mustache. I have a couple of 'widgets', one has a link which triggers an event, and another is set up to listen to it. So far so good. The listening widget has a data.js file which returns an associative array; and mustache.ht开发者_开发问答ml which uses the values return by data.js to fill in the template.
My data.js is something like
function( data ){
return {
name : 'people'
}
}
and the mustache.html is
<span id="fadeMe">Hello {{name}}</span>
<a href="#test">Click</a>
All that is good. I know how to add an handler to the click event of the link, by creating a click.js file and putting it in selectors/a[href=#test]/click.js
But I also want to animate the #fadeMe span as soon as it's rendered. Is there a 'mustache-has-rendered-it' event? (doesn't look like judging from the files distributed with CouchApp). How do I achieve this?
Thanks in advance.
You can put a Javascript function in after.js
. This will be called after mustache and selectors. You can verify it in the sources.
UPDATE: note that Evently is not shipped with python couchapp tool anymore.
精彩评论