Usage

Observe notifications received in the foreground.

tsx
// 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>;
}

Signatures

ts
<E extends keyof Events>(event: E, listener: Events[E]): EventSubscription

Type parameters

NameConstraintDefault
E"received"—

Parameters

NameTypeRequiredDescription
eventEYes—
listenerEvents[E]Yes—

Returns

EventSubscription

Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.