Author: reebalazs
Date: Tue Dec 25 12:59:05 2007
New Revision: 50084
Modified:
kukit/kukit.js/branch/ree-service-layer-and-refactoring/ (props changed)
kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/eventreg.js
Log:
Refactor event binding on an instance:
previously we iterated on all known eventsets, now we only visit the
events actually set up in the binder instance.
May be a bigger difference with lots of registered events.
Modified:
kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/eventreg.js
==============================================================================
--- kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/eventreg.js
(original)
+++ kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/eventreg.js
Tue Dec 25 12:59:05 2007
@@ -361,6 +361,9 @@
this.decorateEventBinderClass = function(cls) {
// See if we are set up already?
+ // XXX XXX this will cause a problem if classes
+ // are inherited from each other... then classNames
+ // would not be set... hmm...
var p = cls.prototype;
if (p.__decorated_for_kss__) {
return;
@@ -593,7 +596,11 @@
var interfaces = kukit.interfaces.global;
// Let's see all our events in a cycle.
processed = {};
- for (var eventName in interfaces.binditerations) {
+ // We iterate through the event names in this binder instance only.
+ // However we process the event names in groups according
+ // to the bind iterations registry. This means processing will
+ // "steal" event names that come later.
+ for (var eventName in this.infoPerName) {
// We only iterate an event once and we greedily iterate
// all events which are in the same eventset - so we may
// get here by this event name already processed.
@@ -601,6 +608,7 @@
continue;
}
// One iteration consists of more events. Process all these.
+ // (One of these is eventName itself, but we need not care.)
var iteration = interfaces.binditerations[eventName];
// Let's exit if this element does not exist
// (the interface registry finalizes invalid methods to undefined)
@@ -608,7 +616,8 @@
continue;
}
var eventSet = iteration.eventNames;
- // Make sure we exclude this element,
+ // Make sure we exclude these event names
+ // from further processing.
for (var i=0; i<eventSet.length; i++) {
processed[eventSet[i]] = true;
}
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins