public static IDisposable AddJsEventListener(this IJSRuntime jsRuntime, JsObjectRef jsObjectRef, string property, string event_, JsEventHandler callBack) { var listenerId = jsRuntime.Invoke <int>("JsInterop.addEventListener", jsObjectRef, property, event_, callBack); return(new DisposableAction(() => jsRuntime.InvokeVoid("JsInterop.removeEventListener", jsObjectRef, property, event_, listenerId))); }
public static void SetJsProperty(this IJSRuntime jsRuntime, object parent, string property, object value) { jsRuntime.InvokeVoid( "JsInterop.setProperty", new object[] { parent, property, value }); }
public static void CallJsMethodVoid(this IJSRuntime jsRuntime, object parent, string method, params object[] args) { var invokeParams = new object[] { parent, method }; if (args != null) { invokeParams = invokeParams.Concat(args).ToArray(); } jsRuntime.InvokeVoid("JsInterop.callMethod", invokeParams); }