has(method)

rich.has(method) is the live capability probe of the rich-client handle: it checks whether the bridge (window.osClient) currently exposes the member method as a function. It is a method of the rich-client handle — the handle is obtained once via dashlet.getRichClientApi(); has() probes the bridge on every call (live, no cache).

1. Signature

has(method: string): boolean;

2. Parameters

Name Type Description

method

string

The name of the bridge member (e.g. 'osjxGetEnvironment', 'osjxOpenObject') — the probe checks window.osClient[method].

3. Behavior

has() is synchronous and returns true exactly when the bridge member exists and is a function — the exact probeFunction semantics. All other states yield false:

Bridge state Result Note

method exists and is a function

true

method is missing, undefined or not a function

false

The read of method throws (host proxy)

false

Both host behaviors — throwing reads and silent undefined results — count as "not present".

window.osClient is missing or not an object

false

No cache. Every call probes the current bridge state — window.osClient is read per call, without a snapshot. A bridge surface swapped in or reduced later becomes visible immediately: a member injected later yields true from then on, a removed one false.

Never an error for the bridge state. A missing, non-functional or exception-throwing member yields false — not an error.

Reduced bridge. The reduced COM-OpenBrowser bridge carries only osjxGetBrowserEnvironment + osjxSetBrowserCaption (without the dashlet marker member osjxGetSelectedObjects); there therefore: rich.has('osjxGetSelectedObjects') → false and rich.has('osjxGetBrowserEnvironment') → true.

Pattern. has('osjxGetEnvironment') distinguishes a missing member from an unknown slot for getEnvironment(code): an unknown slot (the member exists, the code is unknown) yields null, while has() stays true; a missing member makes has() yield false.

4. Examples

if (rich.has('osjxGetEnvironment')) { const lang = rich.getEnvironment(24); }

5. Errors

has() throws for no bridge state — a non-readable or exception-throwing member yields false instead of an error. The only hard errors are:

  • Error('dashlet destroyed') — the dashlet was destroyed (guard of every handle method, including has()).

  • TypeError: Dashlet.getRichClientApi(): the environment is not resolved yet - await the dashlet.init promise first — the accessor was called before the environment was resolved.

  • TypeError: Dashlet.getRichClientApi(): the rich client API handle is only available in the richClient environment (current: …) — the accessor was called in the wrong environment (the current value is named).