notifications.ReceivedNotification
A notification that arrived while the app is in the foreground.
Utilisation
Refresh an inbox when a notification arrives in the foreground.
// Refresh an inbox when a notification arrives in the foreground.
import { notifications, type ReceivedNotification } from 'kuito';
export function followNotifications(refresh: () => void) {
return notifications.watch('received', (notification: ReceivedNotification) => {
console.log(notification.id, notification.remote ? 'Push' : 'Local');
refresh();
});
}
// Outside a component, call remove() on the returned subscription when finished.Déclaration du type
export type ReceivedNotification = NotificationDelivery;Membres 6
| Nom | Type | Requis | Description |
|---|---|---|---|
id | string | Oui | — |
title | string | Non | Absent for a push without one. |
body | string | Non | — |
url | string | Non | — |
data | Json | Non | The payload's own keys, beside the system's (aps) and url. |
remote | boolean | Oui | A server sent it, rather than schedule. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.