Documentation
    Preparing search index...

    Function createConfigService

    • Create a NAP-CONFIG reference service.

      Shell-writes, napplet-reads. Handles the full @napplet/nap/config wire protocol: config.get (correlated snapshot), config.subscribe / config.unsubscribe (live push stream), config.registerSchema (optional schema registration + Core Subset validation), config.openSettings (optional UI deep-link, fire-and-forget).

      Returns a ConfigService bundle: { handler, publishValues }. Register handler with the runtime; call publishValues(newValues) from the shell whenever config state changes.

      Parameters

      • options: ConfigServiceOptions

        Host-supplied implementation hooks (options-as-bridge, v1.6 Decision 18). getValues is required; all other fields are optional.

      Returns ConfigService

      A ConfigService bundle.

      • ConfigServiceOptions for the options shape.
      • packages/services/src/theme-service.ts for the sibling pattern.
      • SCOPE BOUNDARY comment at the top of this file re: NAP-STORAGE separation.
      import { createConfigService } from '@kehto/services';

      const config = createConfigService({
      getValues: () => ({ theme: 'dark', density: 'compact' }),
      openSettings: (windowId, section) => openSettingsUI(section),
      });
      runtime.registerService('config', config.handler);

      // Push a live update to all subscribers:
      config.publishValues({ theme: 'light', density: 'compact' });