ScaleBun
Skip to article

Push

webDeveloper

The ScaleBun.push namespace — 5 members.

Updated Reviewed
TypeScript
import ScaleBun from '@scalebun/web';
ScaleBun.push.<method>(…);

Members#

MemberSignature
enableenable(opts?: PushEnableOptions): Promise<PushEnableStatus>
disabledisable(opts?: { revokeServerSide?: boolean }): Promise<boolean>
statusstatus(): Promise<PushStatus>
getSubscriptiongetSubscription(): Promise<PushSubscriptionJSON | null>
checkcheck(opts?: { serviceWorkerUrl?: string }): Promise<PushDiagnostics>

Reference#

enable#

TypeScript
ScaleBun.push.enable(opts?: PushEnableOptions): Promise<PushEnableStatus>

Subscribe to Web Push (alias of enablePush) — call from a user gesture.

disable#

TypeScript
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#

TypeScript
ScaleBun.push.status(): Promise<PushStatus>

Current push status (supported / permission / subscribed / endpoint / actionable state).

getSubscription#

TypeScript
ScaleBun.push.getSubscription(): Promise<PushSubscriptionJSON | null>

The current browser PushSubscription JSON, or null.

check#

TypeScript
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.

Push · API reference · Web SDK · ScaleBun