Subj : SM: JS_ExecuteScript and rval To : netscape.public.mozilla.jseng From : "Franky Braem" Date : Sun Apr 06 2003 09:50 pm Hi, I read the following in the API-docs JS_ExecuteScript executes a previously compiled script, script. On successful completion, rval is a pointer to a variable that holds the value from the last executed expression statement processed in the script. What happens when the script only contains a function? I returns undefined. Wouldn't it be nice when the function object is returned? I want to use this to implement a better way for event handling in wxJS. eg. frame.onClose = wxScript("close.js"); close.js looks like this function onCloseHandler() { .... } I've found a workaround for this in JavaScript : function onCloseHandler() { .... } function doit() { return onCloseHandler; } doit(); This works because JS_ExecuteScript puts the return value of doit into rval. Is there a way to avoid this workaround? Franky. .