notifications.ReceivedNotification
A notification that arrived while the app is in the foreground.
Usage
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.Type declaration
export type ReceivedNotification = NotificationDelivery;Members 6
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
title | string | No | Absent for a push without one. |
body | string | No | — |
url | string | No | — |
data | Json | No | The payload's own keys, beside the system's (aps) and url. |
remote | boolean | Yes | A 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.