javascript - Is it possible to invoke a JS function from a different thread? -


i'm trying make 2 different browsers communicate each other through native code host (c++) using js window.external.

the syntax like:

on destination.js:

window.external.register("dest", eventcallbak);   function eventcallback(senderid, data) {       alert("message recieved " + senderid + " data of " + data);   } 

on source.js:

window.external.sendmsg("source", "dest", "hello dest! source..."); 

i've managed synchronously, saving eventcallback parameter, save idispatch , invoke when asked (all in same thread). no problems there.

the troubles begin when trying asynchronously, meaning - saving eventcallback idispatch on 1 thread, , invoke later on in thread, causes invoke method fail hresult of e_unexpected.

any ideas?

thanks,

two browser instances use different instances of js vm. cannot in general take 1 object 1 vm/heap , pass vm/heap.

so need invent kind of marshaling here.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -