Skip to main content

Loading the SDK

Always use the full CDN URL. Never use a relative path like /sdk/v1.js. The CDN version ensures you always run a compatible release.

ES Module Import

Constructor Options

How appId is Resolved

The SDK reads appId from window.__HASP__.appId, which is injected by HASP when your app is served. You never set this yourself. If appId cannot be resolved, the constructor throws immediately with ErrorCode.MissingAppId.

Retry Behavior

The SDK retries automatically for:
  • 429 Rate Limited — respects Retry-After header if present (integer seconds or HTTP-date)
  • 502 Bad Gateway — network infrastructure hiccups
  • Network failures (device offline, DNS failure) — for GET and single-record DELETE only (idempotent)
POST, PATCH, and bulk DELETE are not retried on network failure to avoid double-writes. Single-record DELETE is retried because it is idempotent. 503 Maintenance is never retried — the SDK enters maintenance mode immediately.

Cleanup

Call destroy() when your app unmounts to abort all in-flight requests and clear event handlers:
Pending promises reject with an AbortError. After destroy(), maintenance event handlers are also cleared.