notifications.PushToken
Where a server sends the device's push: the service and its token.
Verwendung
Register the iOS push token with your notification backend.
// 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
export type PushToken = Token;Mitglieder 2
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
service | "apns" | Ja | — |
token | string | Ja | What 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.