Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.Interop.JSRuntime.Current has been removed #347

Open
pranavkm opened this issue Mar 2, 2019 · 0 comments
Open

Microsoft.Interop.JSRuntime.Current has been removed #347

pranavkm opened this issue Mar 2, 2019 · 0 comments

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Mar 2, 2019

In ASP.NET Core 3.0.0-preview3, we are removing the ability to access the Microsoft.Interop.IJSRuntime via the static JSRuntime.Current property. Application users may continue to access the IJSRuntime instance by injecting it in to their components. For example,

Previously:

// Stock.cshtml
@functions {
    
    public override void OnInit()
    {
        StocksService.OnStockTickerUpdated += stockUpdate =>
        {
            JSRuntime.Current.InvokeAsync<object>(
                "handleTickerChanged", stockUpdate.symbol, stockUpdate.price);
        };
    }
}

After 3.0.0-preview3,

// Stock.cshtml
@inject IJSRuntime JSRuntime

@functions {
    
    public override void OnInit()
    {
        StocksService.OnStockTickerUpdated += stockUpdate =>
        {
            JSRuntime.InvokeAsync<object>(
                "handleTickerChanged", stockUpdate.symbol, stockUpdate.price);
        };
    }
}

Related issue: dotnet/aspnetcore#6828

Please use dotnet/aspnetcore#8117 for discussions.

@pranavkm pranavkm added this to the 3.0.0-preview3 milestone Mar 2, 2019
@aspnet aspnet locked and limited conversation to collaborators Mar 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant