AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

How did you get this to compile?

Open pfeurean opened this issue 7 years ago • 3 comments

this is a great idea but going from static to instanced variables seems like a stretch

namespace MyLib { public static class MyLibElementRefExtensions { private readonly IJSRuntime _jsRuntime;

    public MyJsInterop(IJSRuntime jsRuntime)
    {
        _jsRuntime = jsRuntime;
    }

    public static Task Focus(this ElementRef elementRef)
    {
        return _jsRuntime.InvokeAsync<object>(
            "myLib.focusElement", elementRef);
    }
}

}


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

pfeurean avatar Mar 20 '19 00:03 pfeurean

Hello @pfeurean ... See the Announcement, and there's a linked discussion issue.

  • https://github.com/aspnet/Announcements/issues/347
  • https://github.com/aspnet/AspNetCore/issues/6828 (crosslinked from the Announcement)

his topic will receive another round of updates by the end of March ... Keep an :eye: out for new content. We update the topic's date when we make changes.

guardrex avatar Mar 20 '19 14:03 guardrex

I'm still somewhat confused by this. How does a static class have an instance member and a nonstatic constructor? @guardrex neither link addresses this: the first discusses cshtml files and the second mentions [Inject], which doesn't occur in the example (which is explicitly called ElementRefExtensions.cs).

dharmaturtle avatar Mar 25 '19 02:03 dharmaturtle

@dharmaturtle Thanks for letting me know ... it probably requires an update. The changes for Preview3 were performed in a rush before I stepped onto a plane to fly out of here, and we couldn't get engineering reviews at that time. I just returned. Engineering should be reviewing it soon, too. They're also just getting settled back into a normal workflow now that Preview3 and the MVP Summit are behind us.

I'll ping u on the PR for the next round of updates to the topic. I'm going to work that next, so you should get a ping sometime today. If another round of updates doesn't help, you can ask the engineers directly on the discussion issue attached to the Announcement.

btw --- I like the avatar! :smile: :+1:

guardrex avatar Mar 25 '19 16:03 guardrex