Fix bug 329 which accumulates clipping rectangles on subsequent draws.
[dygraphs.git] / jsdoc-toolkit / app / frame / Reflection.js
CommitLineData
629a09ae
DV
1/**@constructor*/
2function Reflection(obj) {
3 this.obj = obj;
4}
5
6Reflection.prototype.getConstructorName = function() {
7 if (this.obj.constructor.name) return this.obj.constructor.name;
8 var src = this.obj.constructor.toSource();
9 var name = src.substring(name.indexOf("function")+8, src.indexOf('(')).replace(/ /g,'');
10 return name;
11}
12
13Reflection.prototype.getMethod = function(name) {
14 for (var p in this.obj) {
15 if (p == name && typeof(this.obj[p]) == "function") return this.obj[p];
16 }
17 return null;
18}
19
20Reflection.prototype.getParameterNames = function() {
21 var src = this.obj.toSource();
22 src = src.substring(
23 src.indexOf("(", 8)+1, src.indexOf(")")
24 );
25 return src.split(/, ?/);
26}