200
edits
Changes
no edit summary
When configuring the HtmlUpdate object, there are several callbacks you can supply functions to, for your own code to be called.
=== Section Target callbacks ===
Additonally, you can specify some javascript callback functions to add_section_target, if desired. These can be useful for modifying the HTML returned by Umlaut before it's placed on your page, or modifying other parts of your page upon receiving content.
==== before_update(html, count, target_obj) ====
Called before the Umlaut html is actually on the page, you can use it to modify the HTML before it gets added to the page. "count" is a JS integer count of how many items are included in the section; sometimes you may wish to hide the whole section from the page if there are 0 items; returning "false" from before_update will cause the HtmlUpdater to *not* place the block on the page.
</pre>
==== after_update(html, count, target_obj) ====
Similar to before_update, but called after the html has been placed in the DOM on the page. Not sure what this is useful for, but in after_update you can call JQuery closest() on the html to look up in the DOM if you want. Whereas that's not available in before_update since the html has not yet been placed on the page.
</code>
==== complete(target_obj) ====
Complete on a given section is called after there are no more updates for that section. Currently, the HtmlUpdate isn't smart enough to know that until the entire Umlaut update is done however, so it'll be called at the same time as complete() on the updater as a whole. This may change in the future.
</code>
=== HtmlUpdate callbacks ===
Currently just one, for when the Umlaut update is complete (all content has been fetched).
==== complete(updater_obj) ====
updater.complete = function() {
alert("all content has been fetched!");