Browse SDK

plandalf.addGate()

Register a named access gate.

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

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

Signature

plandalf.addGate(
  name: string,
  flow: string,
  check?: GateCheck<any>,
): void

Arguments

NameTypeMeaning
namestringName used by gate().
flowstringOffer slug to show if access is missing.
check?GateCheck<any>Optional access check. The browser wrapper declares this argument as any and passes it to the typed class method.

Example

addGate.js
plandalf.ready(() => {
  plandalf.addGate('export', 'upgrade', () => false)
})

Returns

void

Behaviour

The check callback can return a boolean or a promise. If omitted, the gate always presents its linked offer.

All plandalf methods

Feature detail