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:
parent
491cbdd119
commit
a4cd6152b6
|
|
@ -52,7 +52,6 @@ namespace Microsoft.JSInterop
|
||||||
}
|
}
|
||||||
public static partial class JSRuntime
|
public static partial class JSRuntime
|
||||||
{
|
{
|
||||||
public static Microsoft.JSInterop.IJSRuntime Current { get { throw null; } }
|
|
||||||
public static void SetCurrentJSRuntime(Microsoft.JSInterop.IJSRuntime instance) { }
|
public static void SetCurrentJSRuntime(Microsoft.JSInterop.IJSRuntime instance) { }
|
||||||
}
|
}
|
||||||
public abstract partial class JSRuntimeBase : Microsoft.JSInterop.IJSRuntime
|
public abstract partial class JSRuntimeBase : Microsoft.JSInterop.IJSRuntime
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,9 @@ namespace Microsoft.JSInterop
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class JSRuntime
|
public static class JSRuntime
|
||||||
{
|
{
|
||||||
private static AsyncLocal<IJSRuntime> _currentJSRuntime
|
private static readonly AsyncLocal<IJSRuntime> _currentJSRuntime = new AsyncLocal<IJSRuntime>();
|
||||||
= new AsyncLocal<IJSRuntime>();
|
|
||||||
|
|
||||||
/// <summary>
|
internal static IJSRuntime Current => _currentJSRuntime.Value;
|
||||||
/// Gets the current <see cref="IJSRuntime"/>, if any.
|
|
||||||
/// </summary>
|
|
||||||
public static IJSRuntime Current => _currentJSRuntime.Value;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the current JS runtime to the supplied instance.
|
/// Sets the current JS runtime to the supplied instance.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue