Skip to content

Quick Start

Rémi BOURGAREL edited this page Jul 17, 2020 · 3 revisions

First install the package

dotnet add package BrowserInterop

Reference the needed JS in your index.html (or in your js bundling tool)

<script src="_content/BrowserInterop/scripts.js"></script>

Then in your template enter the API with the Window() extension method like this :

@using BrowserInterop.Extensions
...
@code {
    protected override async Task OnInitialized()
    {
        var window = await jsRuntime.Window();
        await window.Console.Log("this is a {0}","Log message");
      
    }
}

You can find more usage here : https://github.com/RemiBou/BrowserInterop/tree/master/sample/SampleApp

Clone this wiki locally