<zk>
	<window title="test of long operation" border="normal">
	    <zscript><![CDATA[
			EventQueue eq = EventQueues.lookup("longop"); //create a queue
			String result;
			
			//subscribe async listener to handle long operation
			eq.subscribe(new EventListener() {
			  public void onEvent(Event evt) { //asynchronous
			    org.zkoss.lang.Threads.sleep(2000); //simulate a long operation
			    result = "success"; //store the result
			  }
			}, new EventListener() { //callback
			  public void onEvent(Event evt) {
			    print(result); //show the result to the browser
			    EventQueues.remove("longop");
			  }
			});
			 
			 void print(String msg) {
			     new Label(msg).setParent(inf);
			 }
	    ]]></zscript>
	    <button label="async long op">
	        <attribute name="onClick"><![CDATA[
			   print("Wait for 2 seconds");
			   eq.publish(new Event("whatever")); //kick off the long operation
	        ]]></attribute>
	    </button>
	    <vbox id="inf"/>
	</window>
	
</zk>