Skip to content

Svelte Adapter API

Terminal window
npm install @rep-protocol/svelte @rep-protocol/sdk
function repStore(key: string, defaultValue?: string): Readable<string | undefined>;

Reads a PUBLIC tier variable as a Svelte Readable store.

ParameterTypeDescription
keystringVariable name
defaultValuestringOptional fallback value

Returns: Readable<string | undefined>

Behavior:

  • Synchronous initial value from the payload
  • SSE subscription is lazy — established only when the store has subscribers
  • Updates automatically on config changes via hot reload
  • SSE connection closes when all subscribers unsubscribe
function repSecureStore(key: string): Readable<string | null>;

Reads a SENSITIVE tier variable as a Readable store.

ParameterTypeDescription
keystringVariable name

Returns: Readable<string | null>

Behavior:

  • Starts as null
  • Resolves after session key fetch and decryption
  • Errors are swallowed (SDK logs them); store stays null
  • Does not support hot reload
  • Svelte >= 4 or Svelte 5
  • @rep-protocol/sdk peer dependency