Skip to main content
Access via:io.platform.prefs

PreferencesAPIinterface

Provides methods for retrieving, updating, and resetting platform preferences, as well as for subscribing to preference changes.

io.Connect Desktop 10.6@interopio/desktop 6.24.0

4 Methods

get()⚓︎

<T extends Record<string, unknown> = Record<string, unknown>>() => Promise<PlatformPreferences<T>>

Retrieves an object describing the platform preferences.

reset()⚓︎

(paths: string[]) => Promise<void>

Removes user overrides for the specified settings. Settings without user overrides will use administrator defaults or defaults provided by the platform. Locked settings will remain unchanged.

⚠️ Note that on io.Connect Desktop versions earlier than 10.6, this method isn'supported

Parameters (1)

Name Type Required Description
paths⚓︎ string[]

Array of strings representing paths to the preferences to reset. Use dot notation (e.g., "downloadManager.autoSave").

subscribe()⚓︎

<T extends Record<string, unknown> = Record<string, unknown>>(callback: (snapshot: PlatformPreferences<T>) => void) => UnsubscribeFunction

Subscribes for changes to the platform preferences. Returns an unsubscribe function.

Parameters (1)

Name Type Required Description
callback⚓︎ (snapshot: PlatformPreferences<T>) => void

Callback function that will be invoked with the current platform preferences and after that on each update. The callback may also be invoked with unchanged preferences when another subscription is registered in the same window.

update()⚓︎

(changes: Record<string, unknown>) => Promise<PreferencesUpdateResult>

Updates the user preferences for the platform. Nested objects in changes will be merged with the existing objects, and arrays will replace the existing arrays. Locked settings, invalid values, or schedule settings supplied in changes will be ignored and listed in the ignored property of the result.

⚠️ Note that on io.Connect Desktop versions earlier than 10.6, preferences are merged in the client, which means:

  • Concurrent updates to the same property at the root of the preferences object may overwrite each other.
  • Download and notification settings will be applied after restarting the platform.
  • Schedule settings will be stored but won't schedule platform restart or shutdown.

Parameters (1)

Name Type Required Description
changes⚓︎ Record<string, unknown>

Preferences to merge with the existing user preferences.