notifications.ReceivedNotification
A notification that arrived while the app is in the foreground.
Verwendung
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.Typdeklaration
export type ReceivedNotification = NotificationDelivery;Mitglieder 6
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
id | string | Ja | — |
title | string | Nein | Absent for a push without one. |
body | string | Nein | — |
url | string | Nein | — |
data | Json | Nein | The payload's own keys, beside the system's (aps) and url. |
remote | boolean | Ja | A server sent it, rather than schedule. |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.