notifications.ReceivedNotification
A notification that arrived while the app is in the foreground.
Utilização
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.Declaração do tipo
export type ReceivedNotification = NotificationDelivery;Membros 6
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
id | string | Sim | — |
title | string | Não | Absent for a push without one. |
body | string | Não | — |
url | string | Não | — |
data | Json | Não | The payload's own keys, beside the system's (aps) and url. |
remote | boolean | Sim | A 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.