Skip to content

Commit

Permalink
Minor tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Mar 22, 2022
1 parent e213045 commit b953606
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
13 changes: 5 additions & 8 deletions samples/Blazor.ExampleConsumer/Pages/ClientPosition.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
@page "/geolocation"

@using Microsoft.JSInterop
@using System.Text.Json

@inject IGeolocation Geolocation
@inject IJSInProcessRuntime JavaScript

<PageTitle>Geolocation</PageTitle>
<h1>
Expand All @@ -28,8 +24,8 @@
@{
var (bgClass, json) = (_position, _positionError) switch
{
(_, { }) => ("bg-danger", _positionError.ToJson(_opts)),
({ }, _) => ("bg-dark", _position.ToJson(_opts)),
(null, { }) => ("bg-danger", _positionError.ToJson(_opts)),
({ }, null) => ("bg-dark", _position.ToJson(_opts)),
_ => ("", null)
};
if (bgClass is not "" && json is not null)
Expand All @@ -41,10 +37,12 @@
}

@code {
const string GeolocationOptionsKey = "geolocation-options";
readonly JsonSerializerOptions _opts = new()
{
WriteIndented = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};

readonly PositionOptions _options = new()
Expand All @@ -53,7 +51,6 @@
MaximumAge = 0,
Timeout = 15_000
};

GeolocationPosition? _position;
GeolocationPositionError? _positionError;
bool _isLoading = true;
Expand Down
2 changes: 2 additions & 0 deletions samples/Blazor.ExampleConsumer/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using System.Text.Json
@using System.Text.Json.Serialization
@using Blazor.ExampleConsumer
@using Blazor.ExampleConsumer.Shared
@using Blazor.Serialization.Extensions;
2 changes: 1 addition & 1 deletion src/Blazor.SourceGenerators/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This C# source generator that creates extensions methods on the Blazor WebAssemb
|--|--|--|--|
| [`Blazor.SourceGenerators`](https://www.nuget.org/packages/Blazor.SourceGenerators) | [![NuGet](https://img.shields.io/nuget/v/Blazor.SourceGenerators.svg?style=flat)](https://www.nuget.org/packages/Blazor.SourceGenerators) | [![build](https://github.com/IEvangelist/blazorators/actions/workflows/build-validation.yml/badge.svg)](https://github.com/IEvangelist/blazorators/actions/workflows/build-validation.yml) | Core source generator library. |

It's consumed by the following NuGet packages:
This package is consumed by the following NuGet packages:

- 📦 [Blazor.LocalStorage.WebAssembly](https://www.nuget.org/packages/Blazor.LocalStorage.WebAssembly)
- 📦 [Blazor.LocalStorage.Server](https://www.nuget.org/packages/Blazor.LocalStorage.Server)
Expand Down

0 comments on commit b953606

Please sign in to comment.