Skip to content

Commit

Permalink
Support Blazor 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
galvesribeiro committed Oct 31, 2019
1 parent af5e42a commit 45a2c47
Show file tree
Hide file tree
Showing 17 changed files with 577 additions and 475 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
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
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,5 @@ ASALocalRun/

**/dist/
.DS_Store
dist/
node_modules/
32 changes: 0 additions & 32 deletions .vsts-ci.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .vsts-release.yml

This file was deleted.

146 changes: 73 additions & 73 deletions README.md
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)
Loading

0 comments on commit 45a2c47

Please sign in to comment.