Make JSRuntime.Current non-public (dotnet/extensions#1118)

Fixes https://github.com/aspnet/AspNetCore/issues/6828\n\nCommit migrated from c1d8be8b98
This commit is contained in:
Pranav K 2019-02-19 13:01:13 -08:00 committed by GitHub
parent 491cbdd119
commit a4cd6152b6
2 changed files with 2 additions and 7 deletions

View File

@ -52,7 +52,6 @@ namespace Microsoft.JSInterop
}
public static partial class JSRuntime
{
public static Microsoft.JSInterop.IJSRuntime Current { get { throw null; } }
public static void SetCurrentJSRuntime(Microsoft.JSInterop.IJSRuntime instance) { }
}
public abstract partial class JSRuntimeBase : Microsoft.JSInterop.IJSRuntime

View File

@ -11,13 +11,9 @@ namespace Microsoft.JSInterop
/// </summary>
public static class JSRuntime
{
private static AsyncLocal<IJSRuntime> _currentJSRuntime
= new AsyncLocal<IJSRuntime>();
private static readonly AsyncLocal<IJSRuntime> _currentJSRuntime = new AsyncLocal<IJSRuntime>();
/// <summary>
/// Gets the current <see cref="IJSRuntime"/>, if any.
/// </summary>
public static IJSRuntime Current => _currentJSRuntime.Value;
internal static IJSRuntime Current => _currentJSRuntime.Value;
/// <summary>
/// Sets the current JS runtime to the supplied instance.