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
IJSRuntimecache
ICacheManager
Methods
CheckPermission(bool)
检查浏览器通知权限状态
public ValueTask<bool> CheckPermission(bool requestPermission = true)
Parameters
requestPermission
bool是否请求权限 默认 true
Returns
Dispatch(NotificationItem)
发送浏览器通知
public Task<bool> Dispatch(NotificationItem item)
Parameters
item
NotificationItemNotificationItem 实例
Returns
DispatchCallback(string)
消息通知回调方法由 JS 点击触发
[JSInvokable]
public Task DispatchCallback(string id)
Parameters
id
string
Returns
DisposeAsync()
public ValueTask DisposeAsync()
Returns
DisposeAsync(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
protected virtual ValueTask DisposeAsync(bool disposing)
Parameters
disposing
bool