title: Handle Tapestry zone updates with jQuery
body: <p>I am migrating a Tapestry application from 5.3.7 (and got5) to the current beta release of 5.4. On one particular page I use quite a bit of custom jQuery logic, which causes a problem:</p>
  
  <pre><code>$(document).ready(function() {
          init();
          Event.observe("periodsZone", Tapestry.ZONE_UPDATED_EVENT, function(event) {
              init();
      });
  });
  </code></pre>
  
  <p>What this does is call an init method to register my jQuery event handlers and re-register them after a zone update.</p>
  
  <p>I'm not sure, if this is best practice in the first place (especially mixing up jQuery and Prototype). Anyway, it stopped working in 5.4. I tried to handle the event using jQuery:</p>
  
  <pre><code>$("myZone").on("t5:zone:update", function(event) {
      init();
  });
  </code></pre>
  
  <p>but that does not work either.</p>
  
  <p>What is the correct name of the zone update event in 5.4 and how can I handle it properly?</p>
  
  <p>On a side note, is there already a documentation on how to use jQuery in Tapestry 5.4? Of course I don't expect a beta version to be perfectly documented, but maybe someone can still help me out here.</p>
  
  <p><strong>EDIT:</strong>
  I finally refactored my code to use the Trigger component and JavaScriptSupport.require (it basically works the same for 5.3 using JavaScriptSupport.addInitializerCall):</p>
  
  <p>In my tml:</p>
  
  <pre><code>&lt;t:trigger event="myEvent"/&gt;
  </code></pre>
  
  <p>In my Java code:</p>
  
  <pre><code>public void onMyEvent()
  {
      javaScriptSupport.require("my-module");
  }
  </code></pre>
  
  <p>my-module.js:</p>
  
  <pre><code>define([ "jquery" ], function($) {
      return function() {
          // do my stuff
      }
  }
  </code></pre>
  
  <p>Every time the zone, which includes the trigger, is initially loaded or updated, my JS code is executed.</p>
  
  <p>I'm just very slowly getting an idea, what Tapestry allows you to do with its Javascript capabilities. So far, I love it!</p>