Usage

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.

Type declaration

ts
export type ReceivedNotification = NotificationDelivery;

Members 6

NameTypeRequiredDescription
idstringYes—
titlestringNoAbsent for a push without one.
bodystringNo—
urlstringNo—
dataJsonNoThe payload's own keys, beside the system's (aps) and url.
remotebooleanYesA server sent it, rather than schedule.
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.