Consecutive event triggering in RJS

I know I’ve actually done this before, but I’ve spent the past couple
hours searching Google and my own code and have come up with nothing.

Does anyone know how to trigger events consecutively in RJS? For
instance, if you have something like the following:

page.replace :some_div, render(:partial => “some_partial”)
page.visual_effect :fade, “some_element_in_partial”

The fade effect may not occur if the partial has not finished
rendering when the fade effect is called, thereby leaving the
“some_element_in_partial” visible on the page.

I seem to remember having to create a ‘do’ block and nesting the
effects, while passing in some sort of “serial_event” option or
something like that, but cannot remember exactly.

If it’s prototype based, search for “queue”. At least for the visual
effects, you assign it a queue and the position in the queue. You can
probably wrap everything up in a queue.

For jquery, either chain them or put them into the “on complete”