MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
229 stars 494 forks source link

NOTE: in JS, you have to call start() method to execute invokeScriptAsync() #1192

Open shaikh-amaan-fm opened 5 years ago

shaikh-amaan-fm commented 5 years ago

don't know why MS didn't told us this. when using js, you have to use invokeScriptAsync() in the following way.

//html <x-ms-webview src="URL" id="frm"></x-ms-webview>

//JS var webV = document.getElementById("frm"); webV.invokeScriptAsync("functionName","parameters").start();


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

marb2000 commented 5 years ago

@jevansaks could you assign this to @adambarlow who is driving WebView right now?

wegoodwin commented 4 years ago

@shaikh-amaan-fm

How do you call this method within an event like a click or DOMContentLoaded event? When I added start to the end of invokescriptasync I got an error message stating "Cannot await void".

jhwheuer commented 4 years ago

maybe change the signature of your handler method to "async void"?