Skip to content

Commit 45a2c47

Browse files
committed
Support Blazor 3.0.0
1 parent af5e42a commit 45a2c47

File tree

17 files changed

+577
-475
lines changed

17 files changed

+577
-475
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup .NET Core
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 3.0.100
19+
- name: Build
20+
run: dotnet build --configuration Release

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup .NET Core
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 3.0.100
19+
- name: Build
20+
run: dotnet build --configuration Release
21+
- name: Pack
22+
working-directory: src/Blazor.Extensions.WebUSB
23+
run: dotnet pack --configuration Release
24+
- name: Push
25+
working-directory: src/Blazor.Extensions.WebUSB/bin/Release
26+
run: |
27+
dotnet nuget push Blazor.Extensions.WebUSB.*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
28+
- name: Create Release
29+
uses: actions/create-release@master
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: ${{ github.ref }}
34+
release_name: Release ${{ github.ref }}
35+
draft: false
36+
prerelease: false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,5 @@ ASALocalRun/
331331

332332
**/dist/
333333
.DS_Store
334+
dist/
335+
node_modules/

.vsts-ci.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.vsts-release.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

README.md

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
# Canvas
2-
HTML5 WebUSB API implementation for Microsoft Blazor
3-
4-
[![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)
5-
[![Package Version](https://img.shields.io/nuget/v/Blazor.Extensions.WebUSB.svg)](https://www.nuget.org/packages/Blazor.Extensions.WebUSB)
6-
[![NuGet Downloads](https://img.shields.io/nuget/dt/Blazor.Extensions.WebUSB.svg)](https://www.nuget.org/packages/Blazor.Extensions.WebUSB)
7-
[![License](https://img.shields.io/github/license/BlazorExtensions/WebUSB.svg)](https://github.com/BlazorExtensions/WebUSB/blob/master/LICENSE)
8-
9-
# Blazor Extensions
10-
11-
Blazor Extensions are a set of packages with the goal of adding useful things to [Blazor](https://blazor.net).
12-
13-
# Blazor Extensions WebUSB
14-
15-
This package wraps [HTML5 WebUSB](https://wicg.github.io/webusb/) APIs.
16-
17-
# Installation
18-
19-
```
20-
Install-Package Blazor.Extensions.WebUSB
21-
```
22-
23-
# Sample
24-
25-
## Usage
26-
27-
- First add the USB services on Blazor `IServiceCollection`:
28-
29-
```c#
30-
public void ConfigureServices(IServiceCollection services)
31-
{
32-
services.UseWebUSB(); // Makes IUSB available to the DI container
33-
}
34-
```
35-
36-
### To consume on your `.cshtml`:
37-
38-
- On your `_ViewImports.cshtml` add the using entry:
39-
40-
```c#
41-
@using Blazor.Extensions.WebUSB
42-
```
43-
44-
- Then, on your `.cshtml` inject the `IUSB`:
45-
46-
```c#
47-
@inject IUSB usb
48-
```
49-
50-
And then use the `usb` object to interact with connected USB devices thru your Blazor application.
51-
52-
### To inject on a `BlazorComponent` class:
53-
54-
Define a property of type `IUSB` and mark it as `[Injectable]`:
55-
56-
```c#
57-
[Inject] private IUSB _usb { get; set; }
58-
```
59-
60-
Then use the `_usb` variable to interact with the connected USB devices.
61-
62-
**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.
63-
64-
# Contributions and feedback
65-
66-
Please feel free to use the component, open issues, fix bugs or provide feedback.
67-
68-
# Contributors
69-
70-
The following people are the maintainers of the Blazor Extensions projects:
71-
72-
- [Attila Hajdrik](https://github.com/attilah)
73-
- [Gutemberg Ribiero](https://github.com/galvesribeiro)
1+
# Canvas
2+
HTML5 WebUSB API implementation for Microsoft Blazor
3+
4+
[![Build](https://github.com/BlazorExtensions/WebUSB/workflows/CI/badge.svg)](https://github.com/BlazorExtensions/WebUSB/actions)
5+
[![Package Version](https://img.shields.io/nuget/v/Blazor.Extensions.WebUSB.svg)](https://www.nuget.org/packages/Blazor.Extensions.WebUSB)
6+
[![NuGet Downloads](https://img.shields.io/nuget/dt/Blazor.Extensions.WebUSB.svg)](https://www.nuget.org/packages/Blazor.Extensions.WebUSB)
7+
[![License](https://img.shields.io/github/license/BlazorExtensions/WebUSB.svg)](https://github.com/BlazorExtensions/WebUSB/blob/master/LICENSE)
8+
9+
# Blazor Extensions
10+
11+
Blazor Extensions are a set of packages with the goal of adding useful things to [Blazor](https://blazor.net).
12+
13+
# Blazor Extensions WebUSB
14+
15+
This package wraps [HTML5 WebUSB](https://wicg.github.io/webusb/) APIs.
16+
17+
# Installation
18+
19+
```
20+
Install-Package Blazor.Extensions.WebUSB
21+
```
22+
23+
# Sample
24+
25+
## Usage
26+
27+
- First add the USB services on Blazor `IServiceCollection`:
28+
29+
```c#
30+
public void ConfigureServices(IServiceCollection services)
31+
{
32+
services.UseWebUSB(); // Makes IUSB available to the DI container
33+
}
34+
```
35+
36+
### To consume on your `.cshtml`:
37+
38+
- On your `_ViewImports.cshtml` add the using entry:
39+
40+
```c#
41+
@using Blazor.Extensions.WebUSB
42+
```
43+
44+
- Then, on your `.cshtml` inject the `IUSB`:
45+
46+
```c#
47+
@inject IUSB usb
48+
```
49+
50+
And then use the `usb` object to interact with connected USB devices thru your Blazor application.
51+
52+
### To inject on a `BlazorComponent` class:
53+
54+
Define a property of type `IUSB` and mark it as `[Injectable]`:
55+
56+
```c#
57+
[Inject] private IUSB _usb { get; set; }
58+
```
59+
60+
Then use the `_usb` variable to interact with the connected USB devices.
61+
62+
**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.
63+
64+
# Contributions and feedback
65+
66+
Please feel free to use the component, open issues, fix bugs or provide feedback.
67+
68+
# Contributors
69+
70+
The following people are the maintainers of the Blazor Extensions projects:
71+
72+
- [Attila Hajdrik](https://github.com/attilah)
73+
- [Gutemberg Ribiero](https://github.com/galvesribeiro)

0 commit comments

Comments
 (0)