InitContext

The single normalized init context shape, produced identically in all three environments. This is the value the dashlet.init promise resolves to — exactly once, including the standalone degraded state (observable, not an error) — and the argument of the onInit and onUpdate listeners.

1. Fields

Field Type Meaning

environment

EnaioEnvironment

'webclient' | 'richClient' | 'standalone' — the resolved runtime environment.

clientType

string | null

Host-declared client type (web, desktop_app, rich_client, …), when known.

clientVersion

string | null

Client version (trimmed), when known.

language

string | null

UI language short code (de, en, …), when known.

session

SessionInfo

guid (session id) and timeoutMs — the session timeout as declared by the host (webclient only), null otherwise.

user

UserInfo

id, name, guid, email (each string | null) and groups (string[]).

context

string | null

Webclient context string (hitlist.result, …); null in the rich client and standalone.

selection

SelectedEntry[]

Uniform selection array (empty when nothing is selected) — element type SelectedEntry.

lastSelectedEntry

SelectedEntry | null

Last selected entry, or null when the selection is empty.

location

LocationInfo | null

Enclosing location (objectId, objectTypeId), or null when none (root).

raw

unknown

The raw host payload, kept for transcript/debugging.

2. How the context was produced

The init emission carries an InitInfo whose source is one of:

source Meaning

webclientEvent

First accepted onInit message (webclient postMessage wire).

richClientSelfInit

Bridge read after window.osClient appeared (no host event).

richClientCallback

First host call of window.osDashletInit.

standalone

Detection timeout elapsed without bridge or event.

Security: host strings are untrusted input. The host-provided strings in this context (user name / full name / email, session guid, clientType / clientVersion, language, context) come from the host and must be treated as untrusted: escape them before inserting them into HTML — a same-origin or learning-mode page can craft them.

3. Example

const context = await dashlet.init;

if (context.environment === 'standalone') {
    showOfflineFallback();
    return;
}

// Escape before any HTML insertion — host strings are untrusted:
renderUser(escapeHtml(context.user.name));