Skip to content

VariantRegistry

Defined in: variant.ts:87

new VariantRegistry(): VariantRegistry

VariantRegistry

get(key): string | undefined

Defined in: variant.ts:96

The variant to request for this pin key — the campaign id, or the surface id for surface-only islands — if one is already pinned. Undefined means “let the server choose” — which it should, exactly once.

string

string | undefined


pin(key, variantId): string

Defined in: variant.ts:109

Record a resolved variant. First writer wins.

Later calls are ignored rather than overwriting, because a second resolution arriving at all means one island raced ahead of the pin — and in that case the right repair is to keep the value already reported on the impression, not to adopt the newer one and disagree with our own analytics.

string

string

string


reserve(key, timeoutMs?): VariantReservation

Defined in: variant.ts:126

Claim, or wait for, this page view’s variant for a pin key (campaign id, or surface id for surface-only islands).

The first caller (per key, per page view) gets a LEADER reservation and must eventually call resolve or abort on it. Everyone else gets a FOLLOWER whose promise resolves with the leader’s variant, capped at timeoutMs. A key that is already pinned returns a follower whose promise is already resolved — awaiting it costs one microtask.

string

number = RESERVATION_TIMEOUT_MS

VariantReservation


reset(): void

Defined in: variant.ts:173

New page view. Call on client-side navigation.

void