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
Post a Comment