Author: fschulze
Date: Wed Nov 16 18:30:18 2005
New Revision: 1847

Modified:
   azax/trunk/azax/azax.js
   azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.azax
Log:
Added a timer event.
This is the first stab at implementing special events. All this needs some 
cleanup, like preventing namespace pollution and adding proper registries.


Modified: azax/trunk/azax/azax.js
==============================================================================
--- azax/trunk/azax/azax.js     (original)
+++ azax/trunk/azax/azax.js     Wed Nov 16 18:30:18 2005
@@ -125,13 +125,31 @@
   }
 }
 
+AzaxEvent = function() {
+    this.func = null;
+}
+
+azaxevent_registry = new Array();
+
 Azax.RuleProcessor.prototype.setupEvent = function(rule)
 {
   var nodes = cssQuery(rule.selector);
   for (var y=0; y < nodes.length; y++)
   {
     node = nodes[y];
-    if (rule.property_type == "event") {
+    if (rule.property_type == "azaxevent") {
+        var azaxevent = new AzaxEvent();
+        var index = azaxevent_registry.length;
+        var func_str = "azaxevent_registry["+index+"].func();";
+        azaxevent.action = rule.action;
+        azaxevent.func_str = func_str;
+        azaxevent.func = function() {
+            Azax.notifyServer(this.action);
+            setTimeout(this.func_str, 1000);
+        }
+        azaxevent_registry[index] = azaxevent;
+        setTimeout(func_str, 1000);
+    } else if (rule.property_type == "event") {
         var func = function() {Azax.notifyServer(rule.action);}
         registerEventListener(node, rule.name, func);
     } else {

Modified: azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.azax
==============================================================================
--- azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.azax        
(original)
+++ azax/trunk/demos/azaxdemo/browser/azax_three_autoupdate.azax        Wed Nov 
16 18:30:18 2005
@@ -1,6 +1,7 @@
 <?xml version="1.0"?>
 <rules>
   <rule selector="div#update-area">
+    <azaxevent name="timeout">getCurrentTime</azaxevent>
     <event name="click">getCurrentTime</event>
   </rule>
 </rules>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to