DashletOptions

The options argument of installDashletGlobal(options). Every field is optional; the library runs with fully working defaults.

1. Signature

interface DashletOptions {
    expectedOrigin?: string | null;
    timeoutMs?: number;
    pollIntervalMs?: number;
    detectionTimeoutMs?: number;
    window?: WindowLike;
}

2. Parameters

Name Type Default Description

expectedOrigin

string | null

—

The origin of the webclient host that may send messages (e.g. https://enaio.example.com). Configured per deployment — never hardcoded, and never "*". A usable value switches the wire to strict mode and disables origin learning; when omitted, the wire runs in learning mode inside an iframe (the trusted origin is learned from the first onInit). The desktop-app host origin is the string "null" (plus the legacy file://, file:///, file serializations — one group, bidirectional). Any other non-URL, non-group value is rejected at install time with a descriptive TypeError. Details: Origin configuration.

timeoutMs

number

5000

Standard response timeout in milliseconds for every method call — the webclient wire calls and the standalone bounded rejections. On timeout the call rejects with the bounded TimeoutError (see Errors).

pollIntervalMs

number

50

Rich-client bridge polling interval in milliseconds — how often window.osClient is probed until it appears or the detection cap elapses.

detectionTimeoutMs

number

5000

Detection cap in milliseconds: how long the dashlet probes for a bridge / waits for an onInit before it reports the standalone state.

window

WindowLike

current global window

The window object the library operates on. Defaults to the current global window; inject it in unit tests (the library keeps no other environment assumption).

Relevance per environment:

Environment Options that matter

webclient

expectedOrigin (strict vs. learning), timeoutMs

rich client

pollIntervalMs, detectionTimeoutMs

standalone

detectionTimeoutMs (when the state is reached), timeoutMs (how fast each facade call rejects)

3. Examples

const dashlet = installDashletGlobal({
    expectedOrigin: 'https://enaio.example.com', // strict mode
    timeoutMs: 5000,          // default
    pollIntervalMs: 50,       // default
    detectionTimeoutMs: 5000, // default
});

// learning mode: omit expectedOrigin
const dashlet2 = installDashletGlobal({});

4. Errors

  • TypeError at install time for expectedOrigin values that can never be valid ("*", or any value that is neither an absolute URL nor a file-origin group member) — the rejection happens at install time, not at post time (Origin configuration).