public BlazorHybridRenderer(IPC ipc, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, JSRuntime jsRuntime, Dispatcher dispatcher)
            : base(serviceProvider, loggerFactory)
        {
            _ipc        = ipc ?? throw new ArgumentNullException(nameof(ipc));
            _dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
            _jsRuntime  = jsRuntime ?? throw new ArgumentNullException(nameof(jsRuntime));

            var rootComponent   = new RenderFragmentComponent();
            var rootComponentId = AssignRootComponentId(rootComponent);

            RootRenderHandle = rootComponent.RenderHandle;

            var initTask = _jsRuntime.InvokeAsync <object>(
                "Blazor._internal.attachRootComponentToElement",
                "app",
                rootComponentId,
                _rendererId);

            CaptureAsyncExceptions(initTask);
        }
 public BlazorHybridJSRuntime(IPC ipc)
 {
     _ipc = ipc ?? throw new ArgumentNullException(nameof(ipc));
 }
Beispiel #3
0
 public BlazorHybridJSRuntime(IPC ipc)
 {
     _ipc = ipc ?? throw new ArgumentNullException(nameof(ipc));
     JsonSerializerOptions.Converters.Add(new ElementReferenceJsonConverter());
 }