I\'m creating an application in C# that hosts custom web pages for most of the GUI. As the host, I\'d like to provide a javascript API so that the embedded web pages can ac
As @Frogmouth
noted here already you can pass callback function name to the LongRunningProcedure
:
function onComplete( result )
{
alert( result );
}
function start()
{
window.external.LongRunningProcess( 'data', 'onComplete' );
}
and when LongRunningProcedure
completes use .InvokeScript
as the following:
public void LongRunningProcess(string data, string callbackFunctionName)
{
// do work, call the callback
string codeStrig = string.Format("{0}('{1}')", callbackFunctionName, "{{ Your result value here}}");
webBrowser1.Document.InvokeScript("eval", new [] { codeStrig});
}