-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathUnmarshalledJavaScriptExecutionHandler.cs
More file actions
36 lines (35 loc) · 1.46 KB
/
UnmarshalledJavaScriptExecutionHandler.cs
File metadata and controls
36 lines (35 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using DotNetForHtml5;
using Microsoft.JSInterop;
using Microsoft.JSInterop.WebAssembly;
namespace FastControls.TestApp.Browser.Interop
{
public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler
{
private const string MethodName = "callJSUnmarshalled";
private readonly WebAssemblyJSRuntime _runtime;
public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime)
{
_runtime = runtime as WebAssemblyJSRuntime;
}
public void ExecuteJavaScript(string javaScriptToExecute)
{
_runtime.InvokeUnmarshalled<string, object>(MethodName, javaScriptToExecute);
}
public object ExecuteJavaScriptWithResult(string javaScriptToExecute)
{
return _runtime.InvokeUnmarshalled<string, object>(MethodName, javaScriptToExecute);
}
public TResult InvokeUnmarshalled<T0, TResult>(string identifier, T0 arg0)
{
return _runtime.InvokeUnmarshalled<T0, TResult>(identifier, arg0);
}
public TResult InvokeUnmarshalled<T0, T1, TResult>(string identifier, T0 arg0, T1 arg1)
{
return _runtime.InvokeUnmarshalled<T0, T1, TResult>(identifier, arg0, arg1);
}
public TResult InvokeUnmarshalled<T0, T1, T2, TResult>(string identifier, T0 arg0, T1 arg1, T2 arg2)
{
return _runtime.InvokeUnmarshalled<T0, T1, T2, TResult>(identifier, arg0, arg1, arg2);
}
}
}