Skip to content

Commit

Permalink
add store options
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Oct 1, 2024
1 parent 5aaa591 commit d8ae8b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/store/api-iife.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions plugins/store/guest-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,24 @@ interface ChangePayload<T> {
value: T | null
}

/**
* Options to create a store
*/
export type StoreOptions = {
/**
* Auto save on modification with debounce duration in milliseconds
*/
autoSave?: boolean
}

/**
* @param path: Path to save the store in `app_data_dir`
* @param autoSave: Auto save on modification with debounce duration in milliseconds
* @param options: Store configuration options
*/
export async function createStore(path: string, autoSave?: number) {
export async function createStore(path: string, options?: StoreOptions) {
const resourceId = await invoke<number>('plugin:store|create_store', {
path,
autoSave
...options
})
return new Store(resourceId, path)
}
Expand Down

0 comments on commit d8ae8b2

Please sign in to comment.