Blazor.Javascript.Interop.Extensions
0.0.8
See the version list below for details.
dotnet add package Blazor.Javascript.Interop.Extensions --version 0.0.8
NuGet\Install-Package Blazor.Javascript.Interop.Extensions -Version 0.0.8
<PackageReference Include="Blazor.Javascript.Interop.Extensions" Version="0.0.8" />
<PackageVersion Include="Blazor.Javascript.Interop.Extensions" Version="0.0.8" />
<PackageReference Include="Blazor.Javascript.Interop.Extensions" />
paket add Blazor.Javascript.Interop.Extensions --version 0.0.8
#r "nuget: Blazor.Javascript.Interop.Extensions, 0.0.8"
#addin nuget:?package=Blazor.Javascript.Interop.Extensions&version=0.0.8
#tool nuget:?package=Blazor.Javascript.Interop.Extensions&version=0.0.8
Blazor.Javascript.Interop
Overview
Blazor.Javascript.Interop is a NuGet package designed as an extension library specifically for Blazor projects. It facilitates seamless interoperability between C# code in Blazor and JavaScript, empowering developers to incorporate JavaScript functionalities into their Blazor applications effortlessly.
Features
- Interoperability: Enables smooth communication between C# code in Blazor and JavaScript.
- Simplified Integration: Facilitates easy incorporation of JavaScript functionalities into Blazor applications.
- Boosted Productivity: Streamlines development workflows by eliminating complexities in bridging the gap between C# and JavaScript.
Installation
To install Blazor.Javascript.Interop, simply add the package to your Blazor project via NuGet Package Manager or the .NET CLI:
dotnet add package Blazor.Javascript.Interop
Usage
After installing the package, you can start using it in your Blazor project by following these steps:
Import the Namespace: Import the
Blazor.Javascript.Interop
namespace in your Blazor components where you intend to utilize JavaScript interop functionalities.@using Blazor.Javascript.Interop; @using Blazor.Javascript.Interop.Extensions;
Wrap your Router: Wrap the router component with the <WindowCascadingValue> component
// Example of invoking a JavaScript function from C# code <WindowCascadingValue> <Router AppAssembly="typeof(Program).Assembly"> <Found Context="routeData"> <RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" /> <FocusOnNavigate RouteData="routeData" Selector="h1" /> </Found> </Router> </WindowCascadingValue>
Get the JSWindow object: Utilize the provided methods to invoke JavaScript functions from your C# code.
[CascadingParameter] public required JSWindow Window { get; set; }
Use the javascript methods: Check what are the methods ported to C# from javascript
private async Task CookieEnabledAsync() => cookieEnabled = await Window.Navigator.CookieEnabledAsync();
Compatibility
Blazor.Javascript.Interop is compatible with Blazor projects targeting both server-side and client-side hosting models.
Contributing
Contributions to Blazor.Javascript.Interop are welcome! If you have any ideas for improvements, new features, or encounter any issues, feel free to open an issue or submit a pull request on GitHub.
License
Blazor.Javascript.Interop is licensed under the MIT License.
Acknowledgements
This project is inspired by the growing need for seamless integration between C# and JavaScript in Blazor applications. Special thanks to the Blazor community for their continuous support and feedback.
Note: For more information, detailed examples, and updates, please refer to the GitHub repository. We appreciate your interest and hope Blazor.Javascript.Interop proves to be a valuable addition to your Blazor development toolkit!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Blazor.Javascript.Interop.Extensions:
Package | Downloads |
---|---|
Blazor.Javascript.Interop
Blazor.Javascript.Interop is a NuGet package designed as an extension library specifically for Blazor projects. It facilitates seamless interoperability between C# code in Blazor and JavaScript, empowering developers to incorporate JavaScript functionalities into their Blazor applications effortlessly. |
|
Shoelace.Style
This package provides a Blazor wrapper for the Shoelace UI library, allowing seamless integration of Shoelace components in Blazor applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.4 | 158 | 9/23/2024 |
1.0.3 | 111 | 9/22/2024 |
1.0.2 | 113 | 9/20/2024 |
1.0.1 | 109 | 9/20/2024 |
1.0.0 | 115 | 9/20/2024 |
0.0.14 | 111 | 9/20/2024 |
0.0.13 | 110 | 9/20/2024 |
0.0.12 | 124 | 9/16/2024 |
0.0.11 | 119 | 9/16/2024 |
0.0.9 | 121 | 9/15/2024 |
0.0.8 | 118 | 9/12/2024 |
0.0.4 | 132 | 9/11/2024 |
0.0.3.3 | 193 | 4/12/2024 |
0.0.3.2 | 120 | 4/12/2024 |
0.0.3.1 | 130 | 4/12/2024 |
0.0.3 | 137 | 4/12/2024 |
0.0.2 | 121 | 4/9/2024 |
0.0.1 | 155 | 3/27/2024 |
0.0.1-beta | 86 | 3/27/2024 |