notifications.watch
Calls listener with each notification that arrives while the app is in
the foreground, local or remote; it still shows. In a component it stops
when the component unmounts; elsewhere the returned subscription stops it.
Verwendung
Observe notifications received in the foreground.
// Observe notifications received in the foreground.
import { Text, notifications, signal } from 'kuito';
function Inbox() {
const latest = signal('');
// Stops when Inbox unmounts.
notifications.watch('received', (notification) => {
if (notification.remote) latest.value = notification.title ?? '';
});
return <Text>{latest.value}</Text>;
}Signaturen
<E extends keyof Events>(event: E, listener: Events[E]): EventSubscriptionTypparameter
| Name | Einschränkung | Standard |
|---|---|---|
E | "received" | — |
Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | E | Ja | — |
listener | Events[E] | Ja | — |
Rückgabe
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.