Documentation
    Preparing search index...

    Interface ConfigServiceOptions

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

    const config = createConfigService({
    getValues: () => ({ theme: 'dark', density: 'compact' }),
    openSettings: (windowId, section) => showSettingsPanel(windowId, section),
    });
    interface ConfigServiceOptions {
        onSubscribe?: (windowId: string) => void;
        onUnsubscribe?: (windowId: string) => void;
        openSettings?: (windowId: string, section: string | undefined) => void;
        registerSchema?: (
            windowId: string,
            schema: NappletConfigSchema,
            version: number | undefined,
        ) => ConfigSchemaValidation;
        getValues(): 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.

    openSettings?: (windowId: string, section: string | undefined) => 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 (D10 allows the config-demo napplet to function without a settings UI).

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

    Optional: validate and store a napplet-provided schema.

    If omitted, the ref impl runs its own Core Subset check (hand-coded validator; 30-50 lines) and returns ok/reject. Hosts that need strict draft-07 conformance should provide an ajv-backed implementation.

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

    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).

      Returns ConfigValues