Utilisation

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.

Déclaration du type

ts
export type ReceivedNotification = NotificationDelivery;

Membres 6

NomTypeRequisDescription
idstringOui—
titlestringNonAbsent for a push without one.
bodystringNon—
urlstringNon—
dataJsonNonThe payload's own keys, beside the system's (aps) and url.
remotebooleanOuiA 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.