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.
<PackageVersion Include="ScriptContainer" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="ScriptContainer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version 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.
#:package ScriptContainer@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ScriptContainer&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=ScriptContainer&version=1.3.0
                    
Install as a Cake Tool

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 611 3/23/2024 1.3.0 is deprecated because it is no longer maintained.
1.2.9 265 3/20/2024
1.2.7 276 3/18/2024
1.2.6 252 3/18/2024
1.2.5 229 3/17/2024
1.2.4 242 3/17/2024
1.2.3 470 2/24/2024
1.2.2 351 2/11/2024
1.2.1 252 2/11/2024
1.2.0 236 2/11/2024
1.1.9 679 5/29/2023
1.1.8-prerelease 291 3/5/2023
1.1.7-prerelease 677 11/1/2022
1.1.5-prerelease 216 10/30/2022
1.1.4-prerelease 375 9/18/2022
1.1.3-prerelease 266 9/18/2022
1.1.2-prerelease 632 6/30/2022
1.1.1-prerelease 300 5/8/2022
1.1.0-prerelease 387 4/15/2022
1.0.9-prerelease 398 4/7/2022
1.0.8-prerelease 296 4/6/2022
1.0.7-prerelease 306 4/3/2022
1.0.6-prerelease 405 4/3/2022
1.0.5-prerelease 352 3/22/2022
1.0.4-prerelease 249 3/19/2022
1.0.3-prerelease 267 3/19/2022
1.0.2-prerelease 273 3/16/2022
1.0.1-prerelease 259 3/11/2022