Utilisation

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.

Déclaration du type

ts
export type PushToken = Token;

Membres 2

NomTypeRequisDescription
service"apns"Oui—
tokenstringOuiWhat a server sends the push to: APNs' device token, in hex.
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.