ScriptContainer 1.3.0

dotnet add package ScriptContainer --version 1.3.0
NuGet\Install-Package ScriptContainer -Version 1.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ScriptContainer" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ScriptContainer --version 1.3.0
#r "nuget: ScriptContainer, 1.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ScriptContainer as a Cake Addin
#addin nuget:?package=ScriptContainer&version=1.3.0

// Install ScriptContainer as a Cake Tool
#tool nuget:?package=ScriptContainer&version=1.3.0

Script Container

This RCL library contains .NET wrapper around JS window.onresize event and additional methods to get size of the document or specified HTML element.

  • GetDocBounds() - get document's width and height
  • GetElementBounds(ElementReference) - get element's width and height

Can be used with any Blazor app, either Server side or Wasm.

Status

Install-Package ScriptContainer

GitHub Workflow Status (with event) GitHub GitHub

Sample

The code below is an excerpt. Complete sample can be found in the Samples folder.

@using ScriptContainer
@inject IJSRuntime scriptService

<div @ref="SomeElement">Demo</div>

@code
{
  public ScriptService ScaleService { get; set; }
  public ElementReference SomeElement { get; set; }

  protected override async Task OnAfterRenderAsync(bool setup)
  {
    if (setup)
    {
      ScaleService = new ScriptService(scriptService);

      await ScaleService.CreateModule();
      await GetBounds();

      ScaleService.OnSize = async message => await GetBounds();
    }
  }

  protected async Task GetBounds()
  {
    var docBounds = await ScaleService.GetDocBounds();
    var itemBounds = await ScaleService.GetElementBounds(SomeElement);
  }
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ScriptContainer:

Package Downloads
Canvas.Views.Web

Generic real-time charts for Web and Desktop apps with built-in pan and zoom support.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 133 3/23/2024
1.2.9 93 3/20/2024
1.2.7 93 3/18/2024
1.2.6 86 3/18/2024
1.2.5 71 3/17/2024
1.2.4 83 3/17/2024
1.2.3 196 2/24/2024
1.2.2 128 2/11/2024
1.2.1 83 2/11/2024
1.2.0 80 2/11/2024
1.1.9 342 5/29/2023
1.1.8-prerelease 138 3/5/2023
1.1.7-prerelease 338 11/1/2022
1.1.5-prerelease 87 10/30/2022
1.1.4-prerelease 185 9/18/2022
1.1.3-prerelease 138 9/18/2022
1.1.2-prerelease 275 6/30/2022
1.1.1-prerelease 145 5/8/2022
1.1.0-prerelease 178 4/15/2022
1.0.9-prerelease 179 4/7/2022
1.0.8-prerelease 138 4/6/2022
1.0.7-prerelease 135 4/3/2022
1.0.6-prerelease 199 4/3/2022
1.0.5-prerelease 159 3/22/2022
1.0.4-prerelease 112 3/19/2022
1.0.3-prerelease 118 3/19/2022
1.0.2-prerelease 131 3/16/2022
1.0.1-prerelease 111 3/11/2022