Subj : Re: using js_HashString in a getter callback To : netscape.public.mozilla.jseng From : Sterling Bates Date : Wed May 19 2004 11:15 am Brann Joly wrote: > hi > I'm writing a generic getter, and i need a way to get the name of the > property that needs to be accessed > > As far as i know, id is computed by hashing the name of the property. How > should i deal with that? > Is using the JSHashNumber js_HashString(JSString *str); function the good > solution? > (i would compute the hash of the name using this function when i define the > property, and associate the JSHashNumber with some personal data into a > hashtable) You can do this easily using just the API: JS_ValueToString(cx, id). Then use JS_GetStringChars to get the value of the JSString. Mozilla guys strongly prefer people to restrict themselves to the API. Chances are good you can do whatever you need through it, and it's much easier to give assistance. Sterling .