Browse SDK

plandalf.promo()

Open a live promo handle.

Implemented by the browser object; parameter and return types follow the delegated class declaration.

Workspace snapshot: the inspected SDK has local changes. Source links identify its base commit and may differ from this working copy. Verify the SDK build you deploy before relying on unreleased behavior.

Call this after plandalf.ready(). The browser wrapper can return undefined before initialization.

Signature

plandalf.promo(slug: string, options?: PromoHandleOptions): PromoHandle

Arguments

NameTypeMeaning
slugstringPromo slug to monitor.
options?PromoHandleOptionsOptional countdown target, style, redirect behavior and polling interval.

Example

promo.js
plandalf.ready(async () => {
  const handle = plandalf.promo('early-bird', {
    redirect: false,
  })
  try {
    const state = await handle
    console.log(state?.remaining)
  } finally {
    // This example owns the shared handle and only needs one result.
    handle.close()
  }
})

Returns

PromoHandle

Behaviour

The current workspace browser object forwards both the slug and PromoHandleOptions. Use target for an inline countdown, or omit it for a monitor without a visible widget. redirect defaults to true; set it to false when your page owns navigation. Only inline or headless presentation is implemented. Handles are shared by slug within one SDK instance; the first creation determines polling and redirect options. close() stops that shared handle and its countdown mounts. These option-forwarding and cleanup repairs are not verified as released.

All plandalf methods

Feature detail