Utilização

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.

Declaração do tipo

ts
export type ReceivedNotification = NotificationDelivery;

Membros 6

NomeTipoObrigatórioDescrição
idstringSim—
titlestringNãoAbsent for a push without one.
bodystringNão—
urlstringNão—
dataJsonNãoThe payload's own keys, beside the system's (aps) and url.
remotebooleanSimA server sent it, rather than schedule.
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.