[KSS-checkins] r50062 - kukit/kukit.js/branch/finish-closures/kukit

gotcha at codespeak.net gotcha at codespeak.net
Mon Dec 24 16:54:51 CET 2007


Author: gotcha
Date: Mon Dec 24 16:54:50 2007
New Revision: 50062

Modified:
   kukit/kukit.js/branch/finish-closures/kukit/TODO.txt
   kukit/kukit.js/branch/finish-closures/kukit/eventreg.js
   kukit/kukit.js/branch/finish-closures/kukit/oper.js
   kukit/kukit.js/branch/finish-closures/kukit/plugin.js
Log:
module and class closures in kukit.js

implied refactorings in event registry:
better inheritance done with prototype instantiations

*this implies changing event binder registrations*

the even binders have to be functions with their own methods


Modified: kukit/kukit.js/branch/finish-closures/kukit/TODO.txt
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/TODO.txt	(original)
+++ kukit/kukit.js/branch/finish-closures/kukit/TODO.txt	Mon Dec 24 16:54:50 2007
@@ -1,7 +1,3 @@
-files where closures are missing
-
-plugin.js
-
 files where indentation has to be undone and initialize needs to be done
 
 eventreg.js

Modified: kukit/kukit.js/branch/finish-closures/kukit/eventreg.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/eventreg.js	(original)
+++ kukit/kukit.js/branch/finish-closures/kukit/eventreg.js	Mon Dec 24 16:54:50 2007
@@ -36,7 +36,7 @@
 * 
 * namespace = null: means global namespace
 * defaultActionMethodName = null: if there is no default action implemented
-* func must be a class (constructor) function, this is the class that
+* klass must be a class (constructor) function, this is the class that
 *     implements the binder.
 *
 */
@@ -47,9 +47,9 @@
 
 /* binder registration */
 
-    this.registerBinder = function(className, func) {
-        if (typeof(func) == 'undefined') {
-;;;         kukit.E = 'func argument is mandatory when registering an event';
+    this.registerBinder = function(className, klass) {
+        if (typeof(klass) == 'undefined') {
+;;;         kukit.E = 'klass argument is mandatory when registering an event';
 ;;;         kukit.E += ' binder (_EventRegistry.registerBinder).';
             throw new Error(kukit.E);
         }
@@ -60,30 +60,31 @@
             return;
         
         }
-        // Decorate and store the class
-        decorateEventBinderClass(func);
-        this.classes[className] = func;
+        klass.prototype = new _EventBinder();
+        klass.prototype.__className__ = className;
+        var newKlass = function() {};
+        newKlass.prototype = new klass();
+        this.classes[className] = newKlass;
     };
 
     this.existsBinder = function(className) {
-        var func = this.classes[className];
-        return (typeof(func) != 'undefined');
+        var klass = this.classes[className];
+        return (typeof(klass) != 'undefined');
     };
 
     this.getBinderClass = function(className) {
-        var func = this.classes[className];
-        if (! func) {
+        var klass = this.classes[className];
+        if (! klass) {
             // not found
 ;;;         kukit.E = 'Error : undefined event setup type [' + className + '].';
             throw new Error(kukit.E);
             }
-        return func;
+        return klass;
     };
 
     /* events (methods) registration  helpers (not to be called directly) */
 
-    this._register = 
-        function(namespace, eventName, klass,
+    this._register = function(namespace, eventName, klass,
             bindMethodName, defaultActionMethodName, iterName) {
         if (typeof(defaultActionMethodName) == 'undefined') {
 ;;;         kukit.E = 'Missing arguments when calling [_EventRegistry.register].';
@@ -96,8 +97,8 @@
             className = '' + _eventClassCounter;
             _eventClassCounter += 1;
             this.registerBinder(className, klass);
-            klass.prototype.__className__ = className;
         }
+        var binderKlass = this.getBinderClass(className);
         if (!eventName) {
 ;;;         kukit.E = '[eventName] argument cannot be empty when registering';
 ;;;         kukit.E += ' an event with [_EventRegistry.register].';
@@ -115,13 +116,13 @@
             throw new Error(kukit.E);
         }
         // check bindMethodName and defaultActionMethodName
-        if (bindMethodName && ! klass.prototype[bindMethodName]) {
+        if (bindMethodName && ! binderKlass.prototype[bindMethodName]) {
 ;;;         kukit.E = 'In _EventRegistry.register bind method [' + bindMethodName;
 ;;;         kukit.E += '] is undefined for event [' + eventName;
 ;;;         kukit.E += '] namespace [' + namespace + '].';
             throw new Error(kukit.E);
         }
-        if (defaultActionMethodName && ! klass.prototype[defaultActionMethodName]) {
+        if (defaultActionMethodName && ! binderKlass.prototype[defaultActionMethodName]) {
 ;;;         kukit.E = 'In _EventRegistry.register default action method [';
 ;;;         kukit.E += defaultActionMethodName + '] is undefined for event [';
 ;;;         kukit.E += eventName + '] namespace [' + namespace + '].';
@@ -230,6 +231,11 @@
         } 
         return entry;
     };
+
+    this.getBinderClassByEventNamespace = function(namespace, eventName) {
+       return this.getBinderClass(this.get(namespace, eventName).className);
+    };
+
 };
 
 
@@ -249,7 +255,50 @@
     };
 };
 
-/* Event class decoration 
+/*
+*
+* class _LateBinder
+*
+* postpone binding of actions until called first time
+*
+*/
+var _LateBinder = function(binder, name, node) {
+    this.binder = binder;
+    this.name = name;
+    this.node = node;
+    this.boundEvent = null;
+
+    this.executeActions = function() {
+        if (! this.boundEvent) {
+;;;            var msg = 'Attempt of late binding for event [' + this.name;
+;;;            msg += '], node [' + this.node.nodeName + '].';
+;;;            kukit.log(msg);
+            if (kukit.hasFirebug) {
+                kukit.log(this.node);
+            }
+            var info = kukit.engine.binderInfoRegistry.getBinderInfoById(
+                this.binder.__binderId__);
+            var oper = info.bound.getBoundOperForNode(this.name, this.node);
+            if (oper) {
+                // (if eventRule is null here, we could still have the default
+                // method, so go on.)
+                oper.parms = {};
+                this.boundEvent = function() {
+                    this.binder.triggerEvent(this.name, oper);
+                };
+;;;             kukit.log('Node bound.');
+            } else {
+;;;             kukit.logWarning('No node bound.');
+                this.boundEvent = function() {};
+            }
+        }
+        this.boundEvent();
+    };        
+};
+
+/*
+*
+* class EventBinder
 *
 * poor man's subclassing
 * This is called automatically on registration, to dress
@@ -267,7 +316,7 @@
 *
 * trigger an event bound to a given state instance, same node
 *
-*     binder.__continueEvent__('doit', oper.node, {'extravalue': '5'});
+*     binder.continueEvent('doit', oper.node, {'extravalue': '5'});
 *
 *   with kss rule:
 *
@@ -286,7 +335,7 @@
 * trigger an event bound to a given state instance, and the document
 * (different from current scope)
 *
-*     binder.__continueEvent__('doit', null, {'extravalue': '5'});
+*     binder.continueEvent('doit', null, {'extravalue': '5'});
 *
 *   with kss rule:
 *
@@ -304,7 +353,7 @@
 *
 * trigger an event on all the nodes + document bound to a given state instance
 *
-*     binder.__continueEvent_allNodes__('doit', {'extravalue': '5'});
+*     binder.continueEventAllNodes('doit', {'extravalue': '5'});
 *
 *   with kss rule:
 *
@@ -317,8 +366,9 @@
 * so we create a new oper below
 */
 
-var _EventBinder__continueEvent__ =
-    function(name, node, defaultParameters) {
+var _EventBinder = function() {
+
+this.continueEvent = function(name, node, defaultParameters) {
     // Trigger a continuation event bound to a given state instance, given node
     // (or on document, if node = null)
     //
@@ -362,12 +412,18 @@
         oper.defaultParameters = {};
     }
     // if eventRule is null here, we can yet have the default method, so go on.
-    this._EventBinder_triggerEvent(name, oper);
+    this.triggerEvent(name, oper);
 ;;; kukit.logDebug('Continuation event [' + name + '] executed on same node.');
 };
 
-var _EventBinder__continueEvent_allNodes__ =
-    function(name, defaultParameters) {
+this.__continueEvent__ = function(name, node, defaultParameters) {
+;;; var msg = 'Deprecated [__continueEvent__],';
+;;; msg += 'use [continueEvent] instead !';
+;;; kukit.logWarning(msg);
+this.continueEvent(name, node, defaultParameters);
+};
+
+this.continueEventAllNodes = function(name, defaultParameters) {
     // Trigger an event bound to a given state instance, on all nodes.
     // (or on document, if node = null)
     // if no other nodes execute.
@@ -386,61 +442,34 @@
         } else {
             newOper.defaultParameters = {};
         }
-        this._EventBinder_triggerEvent(name, newOper);
+        this.triggerEvent(name, newOper);
         executed += 1;
     }
 ;;; kukit.logDebug('Event [' + name + '] executed on ' + executed + ' nodes.');
 };
 
-var _EventBinder_makeFuncToBind = function(name, node) {
+this.__continueEvent_allNodes__ = function(name, defaultParameters) {
+;;; var msg = 'Deprecated [__continueEvent_allNodes__],';
+;;; msg += 'use [continueEventAllNodes] instead !';
+;;; kukit.logWarning(msg);
+this.continueEventAllNodes(name, defaultParameters);
+};
+
+this.makeFuncToBind = function(name, node) {
    var executor = new er._LateBinder(this, name, node);
    return function() {
        executor.executeActions();
    };
 };
 
-/*
-*
-* class _LateBinder
-*
-* postpone binding of actions until called first time
-*
-*/
-var _LateBinder = function(binder, name, node) {
-    this.binder = binder;
-    this.name = name;
-    this.node = node;
-    this.boundEvent = null;
-
-    this.executeActions = function() {
-        if (! this.boundEvent) {
-;;;            var msg = 'Attempt of late binding for event [' + this.name;
-;;;            msg += '], node [' + this.node.nodeName + '].';
-;;;            kukit.log(msg);
-            if (kukit.hasFirebug) {
-                kukit.log(this.node);
-            }
-            var info = kukit.engine.binderInfoRegistry.getBinderInfoById(
-                this.binder.__binderId__);
-            var oper = info.bound.getBoundOperForNode(this.name, this.node);
-            if (oper) {
-                // (if eventRule is null here, we could still have the default
-                // method, so go on.)
-                oper.parms = {};
-                this.boundEvent = function() {
-                    this.binder._EventBinder_triggerEvent(this.name, oper);
-                };
-;;;             kukit.log('Node bound.');
-            } else {
-;;;             kukit.logWarning('No node bound.');
-                this.boundEvent = function() {};
-            }
-        }
-        this.boundEvent();
-    };        
+this.__makeFuncToBind__ = function(name, node) {
+;;; var msg = 'Deprecated [__makeFuncToBind__],';
+;;; msg += 'use [makeFuncToBind] instead !';
+;;; kukit.logWarning(msg);
+this.makeFuncToBind(name, node);
 };
 
-var _EventBinder_triggerEvent = function(name, oper) {
+this.triggerEvent = function(name, oper) {
     // Private. Called from __continueEvent__ or from main event execution.
     oper.binder = this;
     if (oper.eventRule) {
@@ -466,9 +495,16 @@
     }
 };
 
+this._EventBinder_triggerEvent = function(name, oper) {
+;;; var msg = 'Deprecated [_EventBinder_triggerEvent],';
+;;; msg += 'use [triggerEvent] instead !';
+;;; kukit.logWarning(msg);
+this.triggerEvent(name, oper);
+};
+
 /* (default) method call handling */
 
-var _EventBinder_callMethod = function(namespace, name, oper, methodName) {
+this.callMethod = function(namespace, name, oper, methodName) {
     // hidden method for calling just a method and checking that is exists.
     // (called from oper)
     var method = this[methodName];
@@ -483,15 +519,14 @@
     method.call(this, name, oper);
 };
 
-var decorateEventBinderClass = function(cls) {
-    cls.prototype.__continueEvent__ = _EventBinder__continueEvent__;
-    cls.prototype.__continueEvent_allNodes__ =
-        _EventBinder__continueEvent_allNodes__;
-    cls.prototype._EventBinder_triggerEvent = _EventBinder_triggerEvent;
-    cls.prototype._EventBinder_callMethod = _EventBinder_callMethod;
-    cls.prototype.__makeFuncToBind__ = _EventBinder_makeFuncToBind;
+this._EventBinder_callMethod = function(namespace, name, oper, methodName) {
+;;; var msg = 'Deprecated [_EventBinder_callMethod],';
+;;; msg += 'use [callMethod] instead !';
+;;; kukit.logWarning(msg);
+this.callMethod(namespace, name, oper, methodName);
 };
 
+};
 /* Event instance registry 
 *
 * class BinderInfoRegistry

Modified: kukit/kukit.js/branch/finish-closures/kukit/oper.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/oper.js	(original)
+++ kukit/kukit.js/branch/finish-closures/kukit/oper.js	Mon Dec 24 16:54:50 2007
@@ -198,7 +198,7 @@
         } else {
             this.parms = {};
         }
-        this.binder._EventBinder_callMethod(
+        this.binder.callMethod(
             namespace, name, this, methodName);
         success = true;
     }
@@ -279,7 +279,7 @@
         // (Filter has a chance to set a defaultParameters on oper.
         if (filter && ! filter(newoper)) return false;
         // execute the event's actions
-        newoper.binder._EventBinder_triggerEvent(eventName, newoper);
+        newoper.binder.triggerEvent(eventName, newoper);
         // show that the event's actions have been executed
         return true;
     };

Modified: kukit/kukit.js/branch/finish-closures/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/plugin.js	(original)
+++ kukit/kukit.js/branch/finish-closures/kukit/plugin.js	Mon Dec 24 16:54:50 2007
@@ -19,7 +19,9 @@
 
 /* Core plugins and utilities */
 
-kukit.pl = {};
+kukit.pl = new function() {   /// MODULE START
+
+var pl = this;
 
 /* 
 * Event plugins 
@@ -37,7 +39,7 @@
 * can be defined to specify a default event action.
 */
 
-kukit.pl.getTargetForBrowserEvent = function(e) {
+pl.getTargetForBrowserEvent = function(e) {
     // this prevents the handler to be called on wrong elements, which
     // can happen because of propagation or bubbling
     // XXX this needs to be tested in all browsers
@@ -60,10 +62,10 @@
 *
 * This can be used to register native events in a way that
 * they handle allowbubbling, preventdefault and preventbubbling as needed.
-* (THe handling of these parms are optional, it is allowed not to have them
+* (The handling of these parms are optional, it is allowed not to have them
 * in the oper.parms.)
 *
-* THe register function can also take a filter function as parameter. 
+* The register function can also take a filter function as parameter. 
 * This function needs to receive oper as a parameter,
 * where 'browserevent' will be set on oper too as the native browser event.
 * The function must return true if it wants the event to execute,
@@ -78,12 +80,12 @@
 * event from the desired one.
 */
 
-kukit.pl.registerBrowserEvent = function(oper, filter, eventName) {
+pl.registerBrowserEvent = function(oper, filter, eventName) {
     var func_to_bind = oper.makeExecuteActionsHook(filter);
     if (! eventName)
         eventName = oper.getEventName();
     var func = function(e) {
-        var target = kukit.pl.getTargetForBrowserEvent(e);
+        var target = pl.getTargetForBrowserEvent(e);
         if (oper.parms.allowbubbling || target == oper.node) {
             // Execute the action, provide browserevent on oper
             // ... however, do it protected. We want the preventdefault
@@ -135,27 +137,23 @@
 /*
 * class NativeEventBinder
 */
-kukit.pl.NativeEventBinder = function() {
-};
+pl.NativeEventBinder = function() {
 
-kukit.pl.NativeEventBinder.prototype.__bind__node =
-    function(name, func_to_bind, oper) {
+this.__bind__node = function(name, func_to_bind, oper) {
 ;;; if (oper.node == null) {
 ;;;     throw new Error('Native event [' + name + '] must be bound to a node.');
 ;;; }
     this.__bind__(name, func_to_bind, oper);
 };
 
-kukit.pl.NativeEventBinder.prototype.__bind__nodeorwindow = 
-    function(name, func_to_bind, oper) {
+this.__bind__nodeorwindow = function(name, func_to_bind, oper) {
     if (oper.node == null) {
         oper.node = window;
     }
     this.__bind__(name, func_to_bind, oper);
 };
 
-kukit.pl.NativeEventBinder.prototype.__bind__window =
-    function(name, func_to_bind, oper) {
+this.__bind__window = function(name, func_to_bind, oper) {
 ;;; if (oper.node != null) {
 ;;;     throw new Error('Native event [' + name + '] must not be bound to a node.');
 ;;; }
@@ -163,16 +161,14 @@
     this.__bind__(name, func_to_bind, oper);
 };
 
-kukit.pl.NativeEventBinder.prototype.__bind__nodeordocument = 
-    function(name, func_to_bind, oper) {
+this.__bind__nodeordocument = function(name, func_to_bind, oper) {
     if (oper.node == null) {
         oper.node = document;
     }
     this.__bind__(name, func_to_bind, oper);
 };
 
-kukit.pl.NativeEventBinder.prototype.__bind__ = 
-    function(name, func_to_bind, oper) {
+this.__bind__ = function(name, func_to_bind, oper) {
 ;;; oper.componentName = 'native event binding';
     oper.evaluateParameters([], 
         {'preventdefault': '', 'allowbubbling': '', 'preventbubbling': ''});
@@ -186,7 +182,7 @@
             throw new Error(kukit.E);
         }
     }
-    kukit.pl.registerBrowserEvent(oper);
+    pl.registerBrowserEvent(oper);
     //
     // XXX Safari hack
     // necessary since Safari does not prevent the <a href...> following
@@ -198,13 +194,14 @@
     if (oper.parms.preventdefault && kukit.HAVE_SAFARI 
             && (oper.parms.allowbubbling || name == 'click'
             && oper.node.tagName.toLowerCase() == 'a')) {
-        oper.node.onclick = function cancelClickSafari() {
+        var cancelClickSafari = function() {
             return false;
         };
+        oper.node.onclick = cancelClickSafari;
     }
 };
 
-kukit.pl.NativeEventBinder.prototype.__bind_key__ =
+this.__bind_key__ =
     function(name, func_to_bind, oper) {
 ;;; oper.componentName = 'native key event binding';
     oper.evaluateParameters([],
@@ -275,52 +272,10 @@
             return true;
         }
     };
-    kukit.pl.registerBrowserEvent(oper, filter);
+    pl.registerBrowserEvent(oper, filter);
+};
 };
 
-/*
-* Registration of all the native events that can bound
-* to a node or to document 
-*  (= document or window, depending on the event specs)
-*  Unsupported are those with absolute no hope to work in a cross browser way
-*  Preventdefault is only allowed for click and key events, currently
-*/
-kukit.eventsGlobalRegistry.register(null, 'blur', kukit.pl.NativeEventBinder,
-    '__bind__nodeorwindow', null);
-kukit.eventsGlobalRegistry.register(null, 'focus', kukit.pl.NativeEventBinder,
-    '__bind__nodeorwindow', null);
-kukit.eventsGlobalRegistry.register(null, 'resize', kukit.pl.NativeEventBinder,
-    '__bind__nodeorwindow', null);
-kukit.eventsGlobalRegistry.register(null, 'click', kukit.pl.NativeEventBinder,
-    '__bind__nodeordocument', null);
-kukit.eventsGlobalRegistry.register(null, 'dblclick',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'mousedown',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
-kukit.eventsGlobalRegistry.register(null, 'mouseup',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
-kukit.eventsGlobalRegistry.register(null, 'mousemove',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
-kukit.eventsGlobalRegistry.register(null, 'mouseover',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'mouseout',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'change',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'reset',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'select',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'submit',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'keydown',
-    kukit.pl.NativeEventBinder, '__bind_key__', null);
-kukit.eventsGlobalRegistry.register(null, 'keypress',
-    kukit.pl.NativeEventBinder, '__bind_key__', null);
-kukit.eventsGlobalRegistry.register(null, 'keyup',
-    kukit.pl.NativeEventBinder, '__bind_key__', null);
-//kukit.eventsGlobalRegistry.register(null, 'unload',
-//    kukit.pl.NativeEventBinder, '__bind__window', null);
 
 /*
 * class TimeoutEventBinder
@@ -331,12 +286,13 @@
 *  unless the binding node has been deleted, in which case it stops,
 *  or it runs only once if repeat=false is given.
 */
-kukit.pl.TimeoutEventBinder = function() {
+pl.TimeoutEventBinder = function() {
+
+this.initialize = function() {
     this.counters = {};
 };
 
-kukit.pl.TimeoutEventBinder.prototype.__bind__ =
-    function(name, func_to_bind, oper) {
+this.__bind__ = function(name, func_to_bind, oper) {
 ;;; oper.componentName = 'timeout event binding';
     oper.evaluateParameters(['delay'], {'repeat': 'true'});
     oper.evalBool('repeat');
@@ -371,17 +327,15 @@
 ;;;     kukit.logDebug(msg);
     }
 };
-
-kukit.eventsGlobalRegistry.register(null, 'timeout',
-    kukit.pl.TimeoutEventBinder, '__bind__', null);
+this.initialize.apply(this, arguments);
+};
 
 /*
 * class LoadEventBinder
 */
-kukit.pl.LoadEventBinder = function() {
-};
+pl.LoadEventBinder = function() {
 
-kukit.pl.LoadEventBinder.prototype.processParameters =
+this.processParameters =
     function(oper, iload) {
     if (! oper) {
         return;
@@ -428,7 +382,7 @@
     return oper;
 };
 
-kukit.pl.LoadEventBinder.prototype.__bind__ = function(opers_by_eventName) {
+this.__bind__ = function(opers_by_eventName) {
     // This bind method handles load and iload events together, and 
     // opers_by_eventName is
     // a dictionary of opers which can contain a load and an iload key,
@@ -541,11 +495,7 @@
     }
 };
 
-// Use the [node] iterator to provide expected invocation
-// and call signature of the bind method.
-kukit.eventsGlobalRegistry.registerForAllEvents(null, ['load', 'iload'],
-    kukit.pl.LoadEventBinder, '__bind__', null, 'Node');
-
+};
 
 /*
 * class SpinnerEventBinder
@@ -553,7 +503,9 @@
 * Spinner support. Besides the event itself we use some utility
 * classes to introduce lazyness (delay) for the spinner.
 */
-kukit.pl.SpinnerEventBinder = function() {
+pl.SpinnerEventBinder = function() {
+
+this.initialize = function() {
     this.state = false;
     var self = this;
     var timeoutSetState = function(spinnerevent) {
@@ -562,7 +514,7 @@
     this.scheduler = new kukit.ut.Scheduler(timeoutSetState);
 };
 
-kukit.pl.SpinnerEventBinder.prototype.__bind__ = function(name, func_to_bind,
+this.__bind__ = function(name, func_to_bind,
     oper) {
 ;;; oper.componentName = '[spinner] event binding';
     oper.evaluateParameters([], {'laziness': 0});
@@ -576,7 +528,7 @@
     kukit.engine.requestManager.registerSpinnerEvent(func, state_to_bind);
 };
 
-kukit.pl.SpinnerEventBinder.prototype.setState = function(func_to_bind, state,
+this.setState = function(func_to_bind, state,
     laziness) {
     // This is called when state changes. We introduce laziness
     // before calling the func.
@@ -587,17 +539,73 @@
     this.scheduler.setNextWakeAtLeast(wakeUp);
 };
 
-kukit.pl.SpinnerEventBinder.prototype.timeoutSetState = function() {
+this.timeoutSetState = function() {
     // really call the bound actions which should set the spinner
     this.func_to_bind();
 };
+this.initialize.apply(this, arguments);
+};
+
+}();                              /// MODULE END
+
+/*
+* Registration of all the native events that can bound
+* to a node or to document 
+*  (= document or window, depending on the event specs)
+*  Unsupported are those with absolute no hope to work in a cross browser way
+*  Preventdefault is only allowed for click and key events, currently
+*/
+kukit.eventsGlobalRegistry.register(null, 'blur', kukit.pl.NativeEventBinder,
+    '__bind__nodeorwindow', null);
+kukit.eventsGlobalRegistry.register(null, 'focus', kukit.pl.NativeEventBinder,
+    '__bind__nodeorwindow', null);
+kukit.eventsGlobalRegistry.register(null, 'resize', kukit.pl.NativeEventBinder,
+    '__bind__nodeorwindow', null);
+kukit.eventsGlobalRegistry.register(null, 'click', kukit.pl.NativeEventBinder,
+    '__bind__nodeordocument', null);
+kukit.eventsGlobalRegistry.register(null, 'dblclick',
+    kukit.pl.NativeEventBinder, '__bind__node', null);
+kukit.eventsGlobalRegistry.register(null, 'mousedown',
+    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
+kukit.eventsGlobalRegistry.register(null, 'mouseup',
+    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
+kukit.eventsGlobalRegistry.register(null, 'mousemove',
+    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
+kukit.eventsGlobalRegistry.register(null, 'mouseover',
+    kukit.pl.NativeEventBinder, '__bind__node', null);
+kukit.eventsGlobalRegistry.register(null, 'mouseout',
+    kukit.pl.NativeEventBinder, '__bind__node', null);
+kukit.eventsGlobalRegistry.register(null, 'change',
+    kukit.pl.NativeEventBinder, '__bind__node', null);
+kukit.eventsGlobalRegistry.register(null, 'reset',
+    kukit.pl.NativeEventBinder, '__bind__node', null);
+kukit.eventsGlobalRegistry.register(null, 'select',
+    kukit.pl.NativeEventBinder, '__bind__node', null);
+kukit.eventsGlobalRegistry.register(null, 'submit',
+    kukit.pl.NativeEventBinder, '__bind__node', null);
+kukit.eventsGlobalRegistry.register(null, 'keydown',
+    kukit.pl.NativeEventBinder, '__bind_key__', null);
+kukit.eventsGlobalRegistry.register(null, 'keypress',
+    kukit.pl.NativeEventBinder, '__bind_key__', null);
+kukit.eventsGlobalRegistry.register(null, 'keyup',
+    kukit.pl.NativeEventBinder, '__bind_key__', null);
+//kukit.eventsGlobalRegistry.register(null, 'unload',
+//    kukit.pl.NativeEventBinder, '__bind__window', null);
+
+kukit.eventsGlobalRegistry.register(null, 'timeout',
+    kukit.pl.TimeoutEventBinder, '__bind__', null);
+
+// Use the [node] iterator to provide expected invocation
+// and call signature of the bind method.
+kukit.eventsGlobalRegistry.registerForAllEvents(null, ['load', 'iload'],
+    kukit.pl.LoadEventBinder, '__bind__', null, 'Node');
+
 
 kukit.eventsGlobalRegistry.register(null, 'spinneron',
     kukit.pl.SpinnerEventBinder, '__bind__', null);
 kukit.eventsGlobalRegistry.register(null, 'spinneroff',
     kukit.pl.SpinnerEventBinder, '__bind__', null);
 
-
 /* Core actions
 *
 * The core client actions that can be executed on the client


More information about the Kukit-checkins mailing list