/// <inheritdoc/> protected async ValueTask DisposeAsyncCore() { foreach (var invoker in JSInvokers) { if (invoker.Value.IsValueCreated) { Logger.LogInformation($"Dispose JS invoker: {invoker.Key}."); var value = await invoker.Value.Value.ConfigureAwait(false); await value.DisposeAsync().ConfigureAwait(false); } } JSInvokers.Clear(); }
/// <inheritdoc/> protected void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { foreach (var invoker in JSInvokers) { if (invoker.Value.IsValueCreated) { Logger.LogInformation($"Dispose JS invoker: {invoker.Key}."); (invoker.Value.Value as IDisposable)?.Dispose(); } } JSInvokers.Clear(); } _disposedValue = true; } }