Verwendung

Refresh an inbox when a notification arrives in the foreground.

tsx
// 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

ts
export type ReceivedNotification = NotificationDelivery;

Mitglieder 6

NameTypErforderlichBeschreibung
idstringJa—
titlestringNeinAbsent for a push without one.
bodystringNein—
urlstringNein—
dataJsonNeinThe payload's own keys, beside the system's (aps) and url.
remotebooleanJaA 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.