-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af5e42a
commit 45a2c47
Showing
17 changed files
with
577 additions
and
475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 3.0.100 | ||
- name: Build | ||
run: dotnet build --configuration Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 3.0.100 | ||
- name: Build | ||
run: dotnet build --configuration Release | ||
- name: Pack | ||
working-directory: src/Blazor.Extensions.WebUSB | ||
run: dotnet pack --configuration Release | ||
- name: Push | ||
working-directory: src/Blazor.Extensions.WebUSB/bin/Release | ||
run: | | ||
dotnet nuget push Blazor.Extensions.WebUSB.*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json | ||
- name: Create Release | ||
uses: actions/create-release@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,3 +331,5 @@ ASALocalRun/ | |
|
||
**/dist/ | ||
.DS_Store | ||
dist/ | ||
node_modules/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,73 @@ | ||
# Canvas | ||
HTML5 WebUSB API implementation for Microsoft Blazor | ||
|
||
[![Build status](https://dotnet-ci.visualstudio.com/DotnetCI/_apis/build/status/Blazor-Extensions-WebUSB-CI?branch=master)](https://dotnet-ci.visualstudio.com/DotnetCI/_build/latest?definitionId=18&branch=master) | ||
[![Package Version](https://img.shields.io/nuget/v/Blazor.Extensions.WebUSB.svg)](https://www.nuget.org/packages/Blazor.Extensions.WebUSB) | ||
[![NuGet Downloads](https://img.shields.io/nuget/dt/Blazor.Extensions.WebUSB.svg)](https://www.nuget.org/packages/Blazor.Extensions.WebUSB) | ||
[![License](https://img.shields.io/github/license/BlazorExtensions/WebUSB.svg)](https://github.com/BlazorExtensions/WebUSB/blob/master/LICENSE) | ||
|
||
# Blazor Extensions | ||
|
||
Blazor Extensions are a set of packages with the goal of adding useful things to [Blazor](https://blazor.net). | ||
|
||
# Blazor Extensions WebUSB | ||
|
||
This package wraps [HTML5 WebUSB](https://wicg.github.io/webusb/) APIs. | ||
|
||
# Installation | ||
|
||
``` | ||
Install-Package Blazor.Extensions.WebUSB | ||
``` | ||
|
||
# Sample | ||
|
||
## Usage | ||
|
||
- First add the USB services on Blazor `IServiceCollection`: | ||
|
||
```c# | ||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.UseWebUSB(); // Makes IUSB available to the DI container | ||
} | ||
``` | ||
|
||
### To consume on your `.cshtml`: | ||
|
||
- On your `_ViewImports.cshtml` add the using entry: | ||
|
||
```c# | ||
@using Blazor.Extensions.WebUSB | ||
``` | ||
|
||
- Then, on your `.cshtml` inject the `IUSB`: | ||
|
||
```c# | ||
@inject IUSB usb | ||
``` | ||
|
||
And then use the `usb` object to interact with connected USB devices thru your Blazor application. | ||
|
||
### To inject on a `BlazorComponent` class: | ||
|
||
Define a property of type `IUSB` and mark it as `[Injectable]`: | ||
|
||
```c# | ||
[Inject] private IUSB _usb { get; set; } | ||
``` | ||
|
||
Then use the `_usb` variable to interact with the connected USB devices. | ||
|
||
**Note**: For now, you have to call `await IUSB.Initialize()` once in your application. This is a temporary requirement and we are looking on a better way to automatically register to _Connect/Disconnect_ events. | ||
|
||
# Contributions and feedback | ||
|
||
Please feel free to use the component, open issues, fix bugs or provide feedback. | ||
|
||
# Contributors | ||
|
||
The following people are the maintainers of the Blazor Extensions projects: | ||
|
||
- [Attila Hajdrik](https://github.com/attilah) | ||
- [Gutemberg Ribiero](https://github.com/galvesribeiro) | ||
# Canvas | ||
HTML5 WebUSB API implementation for Microsoft Blazor | ||
|
||
[![Build](https://github.com/BlazorExtensions/WebUSB/workflows/CI/badge.svg)](https://github.com/BlazorExtensions/WebUSB/actions) | ||
[![Package Version](https://img.shields.io/nuget/v/Blazor.Extensions.WebUSB.svg)](https://www.nuget.org/packages/Blazor.Extensions.WebUSB) | ||
[![NuGet Downloads](https://img.shields.io/nuget/dt/Blazor.Extensions.WebUSB.svg)](https://www.nuget.org/packages/Blazor.Extensions.WebUSB) | ||
[![License](https://img.shields.io/github/license/BlazorExtensions/WebUSB.svg)](https://github.com/BlazorExtensions/WebUSB/blob/master/LICENSE) | ||
|
||
# Blazor Extensions | ||
|
||
Blazor Extensions are a set of packages with the goal of adding useful things to [Blazor](https://blazor.net). | ||
|
||
# Blazor Extensions WebUSB | ||
|
||
This package wraps [HTML5 WebUSB](https://wicg.github.io/webusb/) APIs. | ||
|
||
# Installation | ||
|
||
``` | ||
Install-Package Blazor.Extensions.WebUSB | ||
``` | ||
|
||
# Sample | ||
|
||
## Usage | ||
|
||
- First add the USB services on Blazor `IServiceCollection`: | ||
|
||
```c# | ||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.UseWebUSB(); // Makes IUSB available to the DI container | ||
} | ||
``` | ||
|
||
### To consume on your `.cshtml`: | ||
|
||
- On your `_ViewImports.cshtml` add the using entry: | ||
|
||
```c# | ||
@using Blazor.Extensions.WebUSB | ||
``` | ||
|
||
- Then, on your `.cshtml` inject the `IUSB`: | ||
|
||
```c# | ||
@inject IUSB usb | ||
``` | ||
|
||
And then use the `usb` object to interact with connected USB devices thru your Blazor application. | ||
|
||
### To inject on a `BlazorComponent` class: | ||
|
||
Define a property of type `IUSB` and mark it as `[Injectable]`: | ||
|
||
```c# | ||
[Inject] private IUSB _usb { get; set; } | ||
``` | ||
|
||
Then use the `_usb` variable to interact with the connected USB devices. | ||
|
||
**Note**: For now, you have to call `await IUSB.Initialize()` once in your application. This is a temporary requirement and we are looking on a better way to automatically register to _Connect/Disconnect_ events. | ||
|
||
# Contributions and feedback | ||
|
||
Please feel free to use the component, open issues, fix bugs or provide feedback. | ||
|
||
# Contributors | ||
|
||
The following people are the maintainers of the Blazor Extensions projects: | ||
|
||
- [Attila Hajdrik](https://github.com/attilah) | ||
- [Gutemberg Ribiero](https://github.com/galvesribeiro) |
Oops, something went wrong.