Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install UI through Blazor rather than default banner? #15

Open
ThatRickGuy opened this issue Jan 6, 2020 · 2 comments
Open

Install UI through Blazor rather than default banner? #15

ThatRickGuy opened this issue Jan 6, 2020 · 2 comments

Comments

@ThatRickGuy
Copy link

Looking through your documentation, it sounds like I should be able to put the install button inside my app, but attempting to call await JSRuntime.InvokeAsync<object>("BlazorPWA.installPWA"); results in a WASM error: Microsoft.JSInterop.JSException: Could not find 'BlazorPWA' in 'window'.

I'm assuming I missed a step in there somewhere. I see the ServiceWorker.js and ServiceWorkerRegister.js, but nothing that contains installPWA.

Any pointers for getting the install to kick off from in Blazor, or is the banner the only option?

@SQL-MisterMagoo
Copy link
Owner

you will need some settings in your csproj

<PropertyGroup Label="PWA">
<ServiceWorkerRegisterInstallableType>installable-blazor</ServiceWorkerRegisterInstallableType>
<ServiceWorkerForce>true</ServiceWorkerForce>
</PropertyGroup>

ServiceWorkerRegisterInstallableType tells it you are using Blazor for the install prompt

ServiceWorkerForce just lets it update the generated files - remove it when you have it working

@dknittl
Copy link

dknittl commented Feb 24, 2020

I found this to be a great explanation on how to creat a custom install prompt in Blazor:
https://wellsb.com/csharp/aspnet/create-pwa-from-blazor-app/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants