Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/asathkumara/blazor-jsinterop-helpers
A NuGet package that extends the JavaScript interoperability in Blazor through helpers for interacting with the DOM's Window and Element APIs.
https://github.com/asathkumara/blazor-jsinterop-helpers
blazor blazor-webassembly helpers jsinterop nuget-package
Last synced: about 1 month ago
JSON representation
A NuGet package that extends the JavaScript interoperability in Blazor through helpers for interacting with the DOM's Window and Element APIs.
- Host: GitHub
- URL: https://github.com/asathkumara/blazor-jsinterop-helpers
- Owner: asathkumara
- License: mit
- Created: 2022-07-07T22:54:49.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-19T16:37:56.000Z (over 2 years ago)
- Last Synced: 2024-10-29T15:33:49.374Z (3 months ago)
- Topics: blazor, blazor-webassembly, helpers, jsinterop, nuget-package
- Language: C#
- Homepage: https://www.nuget.org/packages/Blazor.JSInterop.Helpers
- Size: 231 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
![Readme-Banner-1200x300](https://user-images.githubusercontent.com/28933557/185797451-14bc37bd-1ea9-4581-a1f9-fc6770d5cbe3.png)
[![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/Blazor.JSInterop.Helpers?style=plastic)](https://www.nuget.org/packages/Blazor.JSInterop.Helpers) [![Nuget](https://img.shields.io/nuget/dt/Blazor.JSInterop.Helpers?style=plastic)](https://www.nuget.org/packages/Blazor.JSInterop.Helpers)
## Table of Contents
1. [Overview](#overview)
2. [Installation](#installation)
3. [Usage](#usage)
4. [Documentation](#documentation)
5. [License](#license)## Overview
When building robust and complex razor components using Blazor, interactions with the Document Object Model (DOM) become inevitable.
This package extends the JavaScript (JS) interoperability in Blazor through helpers for interacting with the DOM's Window and Element APIs.
## Installation
Package Manager
```powershell
Install-Package Blazor.JSInterop.Handlers -Version 1.1.1
```.NET CLI
```powershell
dotnet add package Blazor.JSInterop.Handlers
```PackageReference
```xml
```
## Usage
To use the package, you first need to configure your dependency injection (DI) container. Add the following line of code to your `Program.cs`:
```csharp
builder.Services.AddBlazorInteropHandlers();
```Then add references to the namespaces in your `_Imports.razor` or as directives at the top of your razor component's page:
```csharp
@using Blazor.JSInterop.Helpers.Services
@using Blazor.JSInterop.Helpers.Models
```Finally, inject instances of the service as needed in your razor component in your directive section or code section:
```csharp
// In directive section
@inject IElementHandler elementHandler
@inject IWindowHandler windowHandler// In code section
@code
{
[Inject] IElementHandler elementHandler;
[Inject] IWindowHandler windowHandler;
}
```## Documentation
> [View complete API documentation and examples on the wiki](https://github.com/asathkumara/blazor-jsinterop-helpers/wiki/API)
## License
This project is licensed under [MIT](https://github.com/asathkumara/blazor-jsinterop-helpers/blob/master/LICENSE.txt). Feel free to re-use any libraries or code for **non-commercial use** but do your due diligence with attributing credit.