Table of Contents

Class NotificationService

Namespace
BootstrapBlazor.Components
Assembly
BootstrapBlazor.dll

浏览器通知服务

public class NotificationService : IAsyncDisposable
Inheritance
NotificationService
Implements
Inherited Members
Extension Methods

Constructors

NotificationService(IJSRuntime, ICacheManager)

构造函数

public NotificationService(IJSRuntime runtime, ICacheManager cache)

Parameters

runtime IJSRuntime
cache ICacheManager

Methods

CheckPermission(bool)

检查浏览器通知权限状态

public ValueTask<bool> CheckPermission(bool requestPermission = true)

Parameters

requestPermission bool

是否请求权限 默认 true

Returns

ValueTask<bool>

Dispatch(NotificationItem)

发送浏览器通知

public Task<bool> Dispatch(NotificationItem item)

Parameters

item NotificationItem

NotificationItem 实例

Returns

Task<bool>

DispatchCallback(string)

消息通知回调方法由 JS 点击触发

[JSInvokable]
public Task DispatchCallback(string id)

Parameters

id string

Returns

Task

DisposeAsync()

public ValueTask DisposeAsync()

Returns

ValueTask

DisposeAsync(bool)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

protected virtual ValueTask DisposeAsync(bool disposing)

Parameters

disposing bool

Returns

ValueTask