Verwendung

Register the iOS push token with your notification backend.

tsx
// Register the iOS push token with your notification backend.
import { notifications, type PushToken } from 'kuito';

export async function registerPush() {
  const token: PushToken = await notifications.register();
  const response = await fetch('https://example.com/push-devices', {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify(token),
  });
  if (!response.ok) throw new Error(`Token registration failed: ${response.status}`);
}
// Call after notification permission is granted; Android push registration is unsupported.

Typdeklaration

ts
export type PushToken = Token;

Mitglieder 2

NameTypErforderlichBeschreibung
service"apns"Ja—
tokenstringJaWhat a server sends the push to: APNs' device token, in hex.
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.