sbin/res/jsdoc/app/frame/Reflection.js
author hamidouk
Fri, 23 Dec 2011 11:38:47 +0100
branchjsdoc
changeset 520 fe008e95a716
permissions -rw-r--r--
added jsdoc support, and a script to generate the docs. Also added sample documentation for the IriSP.widget base class.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
520
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     1
/**@constructor*/
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     2
function Reflection(obj) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     3
	this.obj = obj;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     4
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     5
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     6
Reflection.prototype.getConstructorName = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     7
	if (this.obj.constructor.name) return this.obj.constructor.name;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     8
	var src = this.obj.constructor.toSource();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     9
	var name = src.substring(name.indexOf("function")+8, src.indexOf('(')).replace(/ /g,'');
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    10
	return name;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    11
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    12
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    13
Reflection.prototype.getMethod = function(name) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    14
	for (var p in this.obj) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    15
		if (p == name && typeof(this.obj[p]) == "function") return this.obj[p];
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    16
	}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    17
	return null;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    18
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    19
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    20
Reflection.prototype.getParameterNames = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    21
	var src = this.obj.toSource();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    22
	src = src.substring(
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    23
		src.indexOf("(", 8)+1, src.indexOf(")")
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    24
	);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    25
	return src.split(/, ?/);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    26
}