notifications.PushToken
Where a server sends the device's push: the service and its token.
Utilização
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.Declaração do tipo
export type PushToken = Token;Membros 2
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
service | "apns" | Sim | — |
token | string | Sim | What a server sends the push to: APNs' device token, in hex. |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.