Subj : Need a few hints on JS_CompileFunction To : netscape.public.mozilla.jseng From : Brann Joly Date : Tue May 18 2004 12:16 pm hi I have a few questions about JS_CompileFunction. I did browse http://lxr.mozilla.org/mozilla/ident?i=JS_CompileFunction but didnt found any sample use. I don't understand what the obj parameter is for. The Apidoc says it's the "object with wich the function is associated", but why would I want to do that, since I have to pass an object when i call JS_CallFunction. The second one is this, but what's the first one? It the first one associating a function to an object the same way as JS_DefineFunction does? If so, does it mean my newly compiled function will be callable from javascript by my user, provided the object is in his scope. How should i hide it from him (since it's an event handler, not supposed to be fired by an user) Maybe I'm totally misunderstanding something : here is what I want to do : I have a class jsmethod with 2 functions : init and do. init take a string containing a script (and a description of the arguments) and compile it to a JSFunction * do takes an JSObject * (and an argument list) and calls the function I call Init once to compile the javascript script, and after that each time the event occurs, i call do to actually execute the javascript Is this a correct approach? thx for helping brann .