Subj : Re: Hook into Array To : netscape.public.mozilla.jseng From : Sterling Bates Date : Wed Apr 21 2004 10:57 am "Niklas Lindquist" wrote in message news:c65q9n$nrm1@ripley.netscape.com... > Is there a way to hook into predefined classes e.g. the Array class to get > notifications when individual objects are inserted/reassigned/deleted, or > when the entire Array is sorted or reversed? No -- you have to create your own Array implementation. It's pretty easy, though. > Also, is there a way to not initialize array elements until its values are > requested? In your custom Array class, use the getProperty hook to return the values on the fly. Use JSVAL_TO_INT on the id parameter and you'll have the index value requested by the script (check JSVAL_IS_INT(id) first, though ). > By the way, are there any constraints regarding the number of elements to > the Array class, except runtime memory? That depends on whether there's an overall property limit -- I don't think there is (except memory as you say). Sterling .