[seam-commits] Seam SVN: r11876 - modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Dec 23 05:36:42 EST 2009
Author: shane.bryzak at jboss.com
Date: 2009-12-23 05:36:41 -0500 (Wed, 23 Dec 2009)
New Revision: 11876
Modified:
modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
Log:
why am i using an array?! that's crazy!!
Modified: modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
===================================================================
--- modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-23 10:22:55 UTC (rev 11875)
+++ modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-23 10:36:41 UTC (rev 11876)
@@ -1,5 +1,5 @@
var Seam = {
- beans: new Array(),
+ beans: {},
debug: false,
debugWindow: null,
PATH_EXECUTE: "/execute",
@@ -9,26 +9,20 @@
}
Seam.createBean = function(name) {
- var b = Seam.beans;
- for (var i=0; i<b.length; i++) {
- if (b[i].__name == name) {
- var v = new b[i];
- if (arguments.length > 1) {
- v.__qualifiers = new Array();
- for (var j=1; j<arguments.length; j++) {
- v.__qualifiers.push(arguments[j]);
- }
- }
- return v;
+ if (!Seam.beans[name]) return null;
+ var b = new Seam.beans[name];
+ if (arguments.length > 1) {
+ b.__qualifiers = new Array();
+ for (var i=1; i<arguments.length; i++) {
+ b.__qualifiers.push(arguments[i]);
}
}
- return null;
+ return b;
}
Seam.getBeanType = function(obj) {
- var b = Seam.beans;
- for (var i=0; i<b.length; i++) {
- if (obj instanceof b[i]) return b[i];
+ for (var b in Seam.beans) {
+ if (obj instanceof Seam.beans[b]) return Seam.beans[b];
}
return undefined;
}
@@ -67,23 +61,11 @@
}
}
- var b = Seam.beans;
- for (var i=0; i<b.length; i++) {
- if (b[i].__name == name) {
- b[i] = t;
- return;
- }
- }
- b.push(t);
+ Seam.beans[name] = t;
}
Seam.isBeanRegistered = function(name) {
- var b = Seam.beans;
- for (var i=0; i<b.length; i++) {
- if (b[i].__name == name)
- return true;
- }
- return false;
+ return Seam.beans[name] != null;
}
Seam.getBeanMetadata = function(obj) {
More information about the seam-commits
mailing list