PDA

View Full Version : Extending the Object



jbeduya
22 Oct 2007, 1:06 AM
I am trying to add a simple function into my application so I could easily trace the available methods that i could get in an object instance.


Object.prototype.methods = function() {
var meth = new Array();
for (var i in this) {
if (typeof this[i] === 'function') {
meth.push(i);
}
}
return meth;
};

but Ext gives the following error:


D.addListener is not a function
http://192.168.0.144:3000/javascripts/ext/ext-all.js?1192517968
Line 12

But when I included the code at the very end of the Ext.onReady function it works fine.

Am I breaking something that Ext would not allow me to do?

BernardChhun
22 Oct 2007, 5:40 AM
hmm good question I'd probably say yea it breaks something.

and here's an easier thing to do if you want to list all functions/properties from an object by the way. You need firebug to use it ;)


console.dir(yourObject);