yarn add @ovos-media/fancy-notifications
yarn publish
import { FancyNotifications } from '@ovos-media/fancy-notifications';
async function updateBadgeCount() {
const check = await FancyNotifications.hasPermission();
if(check.value){
FancyNotifications.setBadgeCount(2);
}else{
const request = await FancyNotifications.requestPermission();
if(request.value){
FancyNotifications.setBadgeCount(2);
}else{
// User failed to grant permission show some dialog
}
}
}
Method | Default | Type | Description |
---|---|---|---|
hasPermission | Promise<{value:boolean}> |
||
requestPermission | Promise<{value:boolean}> |
||
setBadgeCount | Promise<any> |
||
clearBadgeCount | Promise<any> |
- Add Notifications Support