View Full Version : A public method to access _instanceAttrs?
spoco2
05-23-2006, 08:58 PM
I wish to access the list of all set attributes within an object as the "_instanceAttrs" attribute provides. However, the _ before the name and the lack of documentation on this suggests that it is a private attribute.
Is there a public way of accessing this?
I will use it for now, but would rather not, in case it changes in the future.
Not sure if it's what you need, but you can do the following..
Where X is some instance.... (or class)
for (var i in X)
{
Debug.write("Attribute: " + i + " = " + X[i]);
}
That seems to give you pretty much everything defined on an object.
it's also useful to itterate through arrays... so instead of:
var t = somearray;
for (var i=0; i<t.length; i++)
{
Use t[i] here
}
you can do
var t = somearray;
for (var i in t)
{
Use t[i] here
}
spoco2
05-24-2006, 05:24 PM
That does indeed give all objects, but includes the subviews object, the subnodes object etc. I'm only really after the user defined attributes, which _instanceAttrs seems to largely give (although it also includes $delegates and another one I can't remember the name of, which are not desired)
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.