Author: gotcha
Date: Sun Oct 26 13:41:08 2008
New Revision: 59421
Modified:
kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/registries.js
kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_registries.js
Log:
remove too complex forEachFactory
Modified:
kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/registries.js
==============================================================================
--- kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/registries.js
(original)
+++ kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/registries.js
Sun Oct 26 13:41:08 2008
@@ -148,21 +148,6 @@
return factory;
};
- /* Iterate a function on each factory of this registrar */
-
- this.forEachFactory = function(f, a1, a2, a3, a4, a5) {
- // Apply f for each factory.
- // f will receive attributeName, attribute, and the rest
- // of the parameters passed to forEachFactory.
- // methodName and MethodDescriptor will be passed to f as parameters.
- // Extra arguments will be passed in addition.
- for (var name in this.factories) {
- var factory = this.factories[name];
- // Provide the necessary parameters and call f
- f(name, factory, a1, a2, a3, a4, a5);
- }
- };
-
this.bindItems = function(registry, loader) {
// singleton: the singleton we want to finalize on.
// loader (optional): use it for all operations
@@ -177,18 +162,14 @@
}
;;; kukit.E = 'Binding registry [' + this.registryName + ']';
;;; kukit.logDebug(kukit.E);
- // Finalize all methods.
- this.forEachFactory(function(name, factory) {
- // finalize the attributes and store them on the registry
- //
-
- // Get the finalized item from this factory
+ for (var name in this.factories) {
+ var factory = this.factories[name];
var item = factory.produceItem(loader);
if (typeof(item) != 'undefined') {
// Set the item on the registry
registry[name] = item;
};
- });
+ };
// Store the registry itself on the registries
// this means that it can be accessed as registries.registryname
this.namedRegistries[this.registryName] = registry;
@@ -207,6 +188,7 @@
}; /* end Registrar */
+
this.NamedRegistries = function() {
this.schema = {};
Modified:
kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_registries.js
==============================================================================
---
kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_registries.js
(original)
+++
kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_registries.js
Sun Oct 26 13:41:08 2008
@@ -75,15 +75,6 @@
registrar.getItemFactory('barItem').doThat()
// Check
this.assertListEquals(called, ['doThis', 'doThat']);
- called = [];
- //
- // Now let's iterate on all factories:
- registrar.forEachFactory(function(name, factory) {
- factory.doThis();
- });
- // Check
- this.assertListEquals(called, ['doThis', 'doThis']);
- called = [];
};
this.testReservedInterfaceNames = function() {
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins