Skip to content
Tauri

LazyStore

Defined in: plugins/store/guest-js/index.ts:81

A lazy loaded key-value store persisted by the backend layer.

  • IStore

new LazyStore(path, options?): LazyStore

Defined in: plugins/store/guest-js/index.ts:96

Note that the options are not applied if someone else already created the store

string

Path to save the store in app_data_dir

StoreOptions

Store configuration options

LazyStore

clear(): Promise<void>

Defined in: plugins/store/guest-js/index.ts:124

Clears the store, removing all key-value pairs.

Note: To clear the storage and reset it to its default value, use reset instead.

Promise<void>

IStore.clear


close(): Promise<void>

Defined in: plugins/store/guest-js/index.ts:169

Close the store and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.

Promise<void>

IStore.close


delete(key): Promise<boolean>

Defined in: plugins/store/guest-js/index.ts:120

Removes a key-value pair from the store.

string

Promise<boolean>

IStore.delete


entries<T>(): Promise<[string, T][]>

Defined in: plugins/store/guest-js/index.ts:140

Returns a list of all entries in the store.

T

Promise<[string, T][]>

IStore.entries


get<T>(key): Promise<undefined | T>

Defined in: plugins/store/guest-js/index.ts:112

Returns the value for the given key or undefined if the key does not exist.

T

string

Promise<undefined | T>

IStore.get


has(key): Promise<boolean>

Defined in: plugins/store/guest-js/index.ts:116

Returns true if the given key exists in the store.

string

Promise<boolean>

IStore.has


init(): Promise<void>

Defined in: plugins/store/guest-js/index.ts:104

Init/load the store if it’s not loaded already

Promise<void>


keys(): Promise<string[]>

Defined in: plugins/store/guest-js/index.ts:132

Returns a list of all keys in the store.

Promise<string[]>

IStore.keys


length(): Promise<number>

Defined in: plugins/store/guest-js/index.ts:144

Returns the number of key-value pairs in the store.

Promise<number>

IStore.length


onChange<T>(cb): Promise<UnlistenFn>

Defined in: plugins/store/guest-js/index.ts:163

Listen to changes on the store.

T

(key, value) => void

Promise<UnlistenFn>

A promise resolving to a function to unlisten to the event.

2.0.0

IStore.onChange


onKeyChange<T>(key, cb): Promise<UnlistenFn>

Defined in: plugins/store/guest-js/index.ts:156

Listen to changes on a store key.

T

string

(value) => void

Promise<UnlistenFn>

A promise resolving to a function to unlisten to the event.

2.0.0

IStore.onKeyChange


reload(): Promise<void>

Defined in: plugins/store/guest-js/index.ts:148

Attempts to load the on-disk state at the store’s path into memory.

This method is useful if the on-disk state was edited by the user and you want to synchronize the changes.

Note: This method does not emit change events.

Promise<void>

IStore.reload


reset(): Promise<void>

Defined in: plugins/store/guest-js/index.ts:128

Resets the store to its default value.

If no default value has been set, this method behaves identical to clear.

Promise<void>

IStore.reset


save(): Promise<void>

Defined in: plugins/store/guest-js/index.ts:152

Saves the store to disk at the store’s path.

Promise<void>

IStore.save


set(key, value): Promise<void>

Defined in: plugins/store/guest-js/index.ts:108

Inserts a key-value pair into the store.

string

unknown

Promise<void>

IStore.set


values<T>(): Promise<T[]>

Defined in: plugins/store/guest-js/index.ts:136

Returns a list of all values in the store.

T

Promise<T[]>

IStore.values


© 2025 Tauri Contributors. CC-BY / MIT