Closed EdCharbeneau closed 4 years ago
Suggested snippets
public async ValueTask<$bool$> $DotnetMethod$()
{
return await _jsRuntime.InvokeAsync<$bool$>("$jsMethod$", DotNetObjectReference.Create(this), $args$);
}
[JSInvokable]
public void $CallbackMethod$() {
// some callback method
// use the interopc snippet in a JavaScript file
// to complete the JavaScript method
$end$
}
window.$jsNameSpace$ = {
$jsMethodName$: function (dotnetHelper, args) {
console.log("js method invoked");
dotnetHelper.invokeMethodAsync('$CallbackMethod$', callbackArgs);
console.log("dotnet method inovoked");
// use the interopc snippet in a C# class file
// to complete the JavaScript method
return true;
}
};
Added in 2.1
Requested by Sillyporridge on show
JsRuntime.InvokeAsync