ScriptContainer 1.0.1-prerelease

This is a prerelease version of ScriptContainer.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ScriptContainer --version 1.0.1-prerelease                
NuGet\Install-Package ScriptContainer -Version 1.0.1-prerelease                
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.0.1-prerelease" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ScriptContainer --version 1.0.1-prerelease                
#r "nuget: ScriptContainer, 1.0.1-prerelease"                
#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.0.1-prerelease&prerelease

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

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.

Nuget

Install-Package ScriptContainer -Version 1.0.1-prerelease

Sample

@using ScriptContainer

<ScriptControl @ref="SomeControl"></ScriptControl>

@code
{
  public ScriptControl SomeControl { get; set; }

  protected override async Task OnAfterRenderAsync(bool setup)
  {
    if (setup)
    {
      SomeControl.OnSize = async message => await GetBounds(); // Subscribe to resize event
      SomeControl.OnLoad = async () => await GetBounds();      // Subscribe to load event
    }
  }

  protected async Task GetBounds()
  {
    var docBounds = await SomeControl.GetDocBounds();
    var itemBounds = await SomeControl.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.

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 356 6/24/2024
1.3.0 317 3/23/2024
1.2.9 128 3/20/2024
1.2.7 134 3/18/2024
1.2.6 124 3/18/2024
1.2.5 104 3/17/2024
1.2.4 118 3/17/2024
1.2.3 260 2/24/2024
1.2.2 187 2/11/2024
1.2.1 120 2/11/2024
1.2.0 111 2/11/2024
1.1.9 451 5/29/2023
1.1.8-prerelease 165 3/5/2023
1.1.7-prerelease 425 11/1/2022
1.1.5-prerelease 103 10/30/2022
1.1.4-prerelease 225 9/18/2022
1.1.3-prerelease 150 9/18/2022
1.1.2-prerelease 362 6/30/2022
1.1.1-prerelease 163 5/8/2022
1.1.0-prerelease 214 4/15/2022
1.0.9-prerelease 222 4/7/2022
1.0.8-prerelease 160 4/6/2022
1.0.7-prerelease 163 4/3/2022
1.0.6-prerelease 235 4/3/2022
1.0.5-prerelease 191 3/22/2022
1.0.4-prerelease 124 3/19/2022
1.0.3-prerelease 134 3/19/2022
1.0.2-prerelease 142 3/16/2022
1.0.1-prerelease 126 3/11/2022