This is what I want to accomplish.
I have created a thread to listen for input via the audio card. From that thread, I want to be able to call a javascript function which will alert the input received (in text form). Since the function running is in a different thread, I know I need to proxy. But how exactly do I need to proxy back to run the JavaScript function.
The JavaScript function is defined as follows:
#include "nsISupports.idl"
interface nsIJSObject;
[scriptable, uuid(bef031c8-1453-48a1-9b4f-b75696834e39)] interface nsISimpleJSO : nsISupports { void handleUtterance(in string utterance); };
and in html:
var jsObjectWrapper = { handleUtterance : function(utterance) { alert (utterance); } }; embed.jsObject = jsObjectWrapper;
I have it working outside of the thread being created. Is what I am
asking even possible? Please help ASAP!
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom
i'm assuming that the code for your background thread is written using C++. in that case, you might want to look at creating an XPCOM proxy object to wrap your JS object. this can be done using the nsIProxyObjectManager (see mozilla/xpcom/proxy). for example, you might create the proxy object from the main thread, and then pass it to your background thread. the background thread can call the proxy object, which will cause the JS object's method to be invoked on the main thread. see NS_GetProxyForObject.
see also http://www.mozilla.org/projects/xpcom/Proxies.html
darin _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
