/// <summary> /// Creates an instance of <see cref="WebAssemblyHostBuilder"/> with the minimal configuration. /// </summary> internal WebAssemblyHostBuilder(IJSUnmarshalledRuntime jsRuntime, JsonSerializerOptions jsonOptions) { // Private right now because we don't have much reason to expose it. This can be exposed // in the future if we want to give people a choice between CreateDefault and something // less opinionated. _jsonOptions = jsonOptions; Configuration = new WebAssemblyHostConfiguration(); RootComponents = new RootComponentMappingCollection(); Services = new ServiceCollection(); Logging = new LoggingBuilder(Services); // Retrieve required attributes from JSRuntimeInvoker InitializeNavigationManager(jsRuntime); InitializeRegisteredRootComponents(jsRuntime); InitializePersistedState(jsRuntime); InitializeDefaultServices(); var hostEnvironment = InitializeEnvironment(jsRuntime); HostEnvironment = hostEnvironment; _createServiceProvider = () => { return(Services.BuildServiceProvider(validateScopes: WebAssemblyHostEnvironmentExtensions.IsDevelopment(hostEnvironment))); }; }
internal WebAssemblyHost( WebAssemblyHostBuilder builder, IServiceProvider services, AsyncServiceScope scope, string?persistedState) { // To ensure JS-invoked methods don't get linked out, have a reference to their enclosing types GC.KeepAlive(typeof(JSInteropMethods)); _services = services; _scope = scope; _configuration = builder.Configuration; _rootComponents = builder.RootComponents; _persistedState = persistedState; }
public static void AddDocumentMetadata(this RootComponentMappingCollection rootComponents) { rootComponents.Add <WebAssemblyMetadataManager>("meta[data-dxmetadatamanager]"); }
private static void ConfigureComponents(RootComponentMappingCollection rootComponents) { rootComponents.Add <App>("app"); }
public void Configure(RootComponentMappingCollection app) { app.Add <Main>("body"); }