ScriptContainer 1.3.1

dotnet add package ScriptContainer --version 1.3.1                
NuGet\Install-Package ScriptContainer -Version 1.3.1                
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.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ScriptContainer --version 1.3.1                
#r "nuget: ScriptContainer, 1.3.1"                
#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.1

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

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.1 478 6/24/2024
1.3.0 321 3/23/2024
1.2.9 132 3/20/2024
1.2.7 138 3/18/2024
1.2.6 128 3/18/2024
1.2.5 112 3/17/2024
1.2.4 124 3/17/2024
1.2.3 264 2/24/2024
1.2.2 197 2/11/2024
1.2.1 128 2/11/2024
1.2.0 119 2/11/2024
1.1.9 455 5/29/2023
1.1.8-prerelease 169 3/5/2023
1.1.7-prerelease 427 11/1/2022
1.1.5-prerelease 105 10/30/2022
1.1.4-prerelease 227 9/18/2022
1.1.3-prerelease 152 9/18/2022
1.1.2-prerelease 364 6/30/2022
1.1.1-prerelease 165 5/8/2022
1.1.0-prerelease 216 4/15/2022
1.0.9-prerelease 224 4/7/2022
1.0.8-prerelease 162 4/6/2022
1.0.7-prerelease 165 4/3/2022
1.0.6-prerelease 239 4/3/2022
1.0.5-prerelease 195 3/22/2022
1.0.4-prerelease 126 3/19/2022
1.0.3-prerelease 136 3/19/2022
1.0.2-prerelease 144 3/16/2022
1.0.1-prerelease 128 3/11/2022