Push
The ScaleBun.push namespace — 5 members.
import ScaleBun from '@scalebun/web';
ScaleBun.push.<method>(…);Members#
| Member | Signature |
|---|---|
enable | enable(opts?: PushEnableOptions): Promise<PushEnableStatus> |
disable | disable(opts?: { revokeServerSide?: boolean }): Promise<boolean> |
status | status(): Promise<PushStatus> |
getSubscription | getSubscription(): Promise<PushSubscriptionJSON | null> |
check | check(opts?: { serviceWorkerUrl?: string }): Promise<PushDiagnostics> |
Reference#
enable#
ScaleBun.push.enable(opts?: PushEnableOptions): Promise<PushEnableStatus>Subscribe to Web Push (alias of enablePush) — call from a user gesture.
disable#
ScaleBun.push.disable(opts?: { revokeServerSide?: boolean }): Promise<boolean>Opt out of Web Push: unsubscribes this browser and revokes the token server-side immediately (pass { revokeServerSide: false } to skip the server call). The device row itself is kept — it carries this device's analytics/replay identity, not just its push token.
status#
ScaleBun.push.status(): Promise<PushStatus>Current push status (supported / permission / subscribed / endpoint / actionable state).
getSubscription#
ScaleBun.push.getSubscription(): Promise<PushSubscriptionJSON | null>The current browser PushSubscription JSON, or null.
check#
ScaleBun.push.check(opts?: { serviceWorkerUrl?: string }): Promise<PushDiagnostics>P1 — diagnose the whole push path and say what to fix. Safe to call anywhere: it never prompts for permission and never throws. Returns { ok, blocking, checks[] } where each check carries its own label + fix text, so a settings screen can render the report generically.