Subj : Re: Properties not defined with JS_DefineProperty possible? To : Thomas Sondergaard From : Brendan Eich Date : Sat Jan 08 2005 02:06 pm Thomas Sondergaard wrote: > I'd like to use Spidermonkey as a glorified expression evaluator in a C++ > application. I already have the values that needs to be available for the > expression evaluator available in a std::map. I'd like to > make the keys in the map available as global properties > with values corresponding to the values in the map. I am > wondering if there is a way that SpiderMonkey can dynamically look up > properties not defined with JS_DefineProperty? Of course -- JSClass.getProperty and JSClass.setProperty can mirror changes from and to your std::map. You can set the JSClass.flags bit JSCLASS_SHARE_ALL_PROPERTIES to avoid any parallel map being managed by SpiderMonkey. Then for each get or set, the appropriate JSClass hook will be called and you can fetch or store using your map. /be .