IJSInProcessObjectReference extended
IJSInProcessObjectReference extensions methods have been added to aid in Javascript interop. JSObject wrapped Javascript objects use the extended IJSInProcessObjectReference reference internally.
IJSInProcessObjectReference extended methods:
"identifier", aka property key, can be any type because that is what Javascript allows.
- CallVoid(object identifier, arg0, ...)
- Call
// Get Set
var window = JS.Get<IJSInProcessObjectReference>("window");
window.Set("myVar", 5);
var myVar = window.Get<int>("myVar");
// Synchronous calls
window.CallVoid("addEventListener", "resize", Callback.Create(() => Console.WriteLine("WindowResized")));
Create a new Javascript object using the BlazorJSRuntime (JS)