Documentation
    Preparing search index...

    Interface ConfigServiceOptions

    Configuration options for createConfigService (options-as-bridge per v1.6 Decision 18).

    const config = createConfigService({
    getValues: (windowId) => loadScopedValues(windowId),
    saveValues: (windowId, values) => saveScopedValues(windowId, values),
    openSettings: (windowId, section, context) => showSettingsPanel(windowId, section, context),
    });
    interface ConfigServiceOptions {
        onSubscribe?: (windowId: string) => void;
        onUnsubscribe?: (windowId: string) => void;
        onWindowDestroyed?: (windowId: string) => void;
        openSettings?: (
            windowId: string,
            section: string | undefined,
            context: ConfigSettingsContext,
        ) => void;
        registerSchema?: (
            windowId: string,
            schema: NappletConfigSchema,
            version: number | undefined,
        ) => ConfigSchemaValidation;
        saveValues?: (windowId: string, values: ConfigValues) => void;
        getValues(windowId: string): ConfigValues;
    }
    Index

    Properties

    onSubscribe?: (windowId: string) => void

    Optional: receive notification when a napplet subscribes to config updates. Fire-and-forget — the service tracks the subscription internally regardless.

    onUnsubscribe?: (windowId: string) => void

    Optional: receive notification when a napplet unsubscribes.

    onWindowDestroyed?: (windowId: string) => void

    Release host-owned transient UI or state for a destroyed window.

    openSettings?: (
        windowId: string,
        section: string | undefined,
        context: ConfigSettingsContext,
    ) => void

    Optional: open the shell-side settings UI for this napplet. Fire-and-forget — no response envelope per the wire spec. If omitted, config.openSettings is silently dropped. A conformant host must supply this hook before advertising the CONFIG domain.

    registerSchema?: (
        windowId: string,
        schema: NappletConfigSchema,
        version: number | undefined,
    ) => ConfigSchemaValidation

    Optional: validate and store a napplet-provided schema.

    The reference implementation always runs its complete bounded Core Subset validator first. This hook may add host policy such as version acceptance or durable schema persistence, but cannot weaken protocol validation.

    Return shape mirrors config.registerSchema.result wire envelope (minus the id — the dispatch layer correlates).

    saveValues?: (windowId: string, values: ConfigValues) => void

    Persist one shell-validated full snapshot after settings UI commit.

    Methods

    • Returns the current configuration values snapshot. Called on every config.get and at every config.subscribe initial push. Implementations should return a fresh object (not a mutable reference).

      Parameters

      • windowId: string

      Returns ConfigValues