tauri-settings
Version:
A user settings manager for Tauri inspired by electron-settings.
38 lines (37 loc) • 2.56 kB
TypeScript
import type { Path, PathValue } from '../utils/dot-notation';
/**
* Checks whether a key exists in the settings.
* @param key The key for the setting. Key supports dot notation. See https://github.com/harshkhandeparkar/tauri-settings#dot-notation.
*/
export declare function has<SettingsSchema = {}, K extends Path<SettingsSchema> = Path<SettingsSchema>>(key: K, configId?: number): Promise<boolean>;
/**
* Checks whether a key exists in the cached settings.
* @param key The key for the setting. Key supports dot notation. See https://github.com/harshkhandeparkar/tauri-settings#dot-notation.
*/
export declare function hasCache<SettingsSchema, K extends Path<SettingsSchema> = Path<SettingsSchema>>(key: K, configId?: number): Promise<boolean>;
/**
* Get the value of a particular setting.
* @param key The key for the setting. Key supports dot notation. See https://github.com/harshkhandeparkar/tauri-settings#dot-notation.
* @returns The value of the setting
*/
export declare function get<SettingsSchema = {}, K extends Path<SettingsSchema> = Path<SettingsSchema>>(key: K, configId?: number): Promise<PathValue<SettingsSchema, K>>;
/**
* Get the value of a particular setting in the cached settings.
* @param key The key for the setting. Key supports dot notation. See https://github.com/harshkhandeparkar/tauri-settings#dot-notation.
* @returns The value of the setting
*/
export declare function getCache<SettingsSchema, K extends Path<SettingsSchema> = Path<SettingsSchema>>(key: K, configId?: number): Promise<PathValue<SettingsSchema, K>>;
/**
* Sets the value of a particular setting.
* @param key The key for the setting. Key supports dot notation. See https://github.com/harshkhandeparkar/tauri-settings#dot-notation.
* @param value The new value
* @returns The entire settings object
*/
export declare function set<SettingsSchema = {}, K extends Path<SettingsSchema> = Path<SettingsSchema>, V extends PathValue<SettingsSchema, K> = PathValue<SettingsSchema, K>>(key: K, value: V, configId?: number): Promise<void>;
/**
* Sets the value of a particular setting in the cached settings.
* @param key The key for the setting. Key supports dot notation. See https://github.com/harshkhandeparkar/tauri-settings#dot-notation.
* @param value The new value
* @returns The entire settings object
*/
export declare function setCache<SettingsSchema, K extends Path<SettingsSchema> = Path<SettingsSchema>, V extends PathValue<SettingsSchema, K> = PathValue<SettingsSchema, K>>(key: K, value: V, configId?: number): Promise<void>;