Skip to content

Commit f0172a4

Browse files
fix(app): correct removeDataStore return type, add docs for getBundle… (#14038)
* fix(app): correct removeDataStore return type, add docs for getBundleType * add change file * fmt --------- Co-authored-by: Lucas Nogueira <[email protected]>
1 parent 5075b67 commit f0172a4

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tauri-apps/cli": patch:bug
3+
---
4+
5+
Fixes `removeDataStore` return type.

packages/api/src/app.ts

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import { invoke } from './core'
66
import { Image } from './image'
77
import { Theme } from './window'
88

9+
/**
10+
* Identifier type used for data stores on macOS and iOS.
11+
*
12+
* Represents a 128-bit identifier, commonly expressed as a 16-byte UUID.
13+
*/
914
export type DataStoreIdentifier = [
1015
number,
1116
number,
@@ -78,7 +83,7 @@ async function getName(): Promise<string> {
7883
}
7984

8085
/**
81-
* Gets the Tauri version.
86+
* Gets the Tauri framework version used by this application.
8287
*
8388
* @example
8489
* ```typescript
@@ -109,7 +114,8 @@ async function getIdentifier(): Promise<string> {
109114
}
110115

111116
/**
112-
* Shows the application on macOS. This function does not automatically focus any specific app window.
117+
* Shows the application on macOS. This function does not automatically
118+
* focus any specific app window.
113119
*
114120
* @example
115121
* ```typescript
@@ -166,37 +172,37 @@ async function fetchDataStoreIdentifiers(): Promise<DataStoreIdentifier[]> {
166172
* ```typescript
167173
* import { fetchDataStoreIdentifiers, removeDataStore } from '@tauri-apps/api/app';
168174
* for (const id of (await fetchDataStoreIdentifiers())) {
169-
* await removeDataStore(id);
175+
* await removeDataStore(id);
170176
* }
171177
* ```
172178
*
173179
* @since 2.4.0
174180
*/
175-
async function removeDataStore(
176-
uuid: DataStoreIdentifier
177-
): Promise<DataStoreIdentifier[]> {
181+
async function removeDataStore(uuid: DataStoreIdentifier): Promise<void> {
178182
return invoke('plugin:app|remove_data_store', { uuid })
179183
}
180184

181185
/**
182-
* Get the default window icon.
186+
* Gets the default window icon.
183187
*
184188
* @example
185189
* ```typescript
186190
* import { defaultWindowIcon } from '@tauri-apps/api/app';
187-
* await defaultWindowIcon();
191+
* const icon = await defaultWindowIcon();
188192
* ```
189193
*
190194
* @since 2.0.0
191195
*/
196+
192197
async function defaultWindowIcon(): Promise<Image | null> {
193198
return invoke<number | null>('plugin:app|default_window_icon').then((rid) =>
194199
rid ? new Image(rid) : null
195200
)
196201
}
197202

198203
/**
199-
* Set app's theme, pass in `null` or `undefined` to follow system theme
204+
* Sets the application's theme. Pass in `null` or `undefined` to follow
205+
* the system theme.
200206
*
201207
* @example
202208
* ```typescript
@@ -217,13 +223,31 @@ async function setTheme(theme?: Theme | null): Promise<void> {
217223
/**
218224
* Sets the dock visibility for the application on macOS.
219225
*
220-
* @param visible whether the dock should be visible or not
226+
* @param visible - Whether the dock should be visible or not.
227+
*
228+
* @example
229+
* ```typescript
230+
* import { setDockVisibility } from '@tauri-apps/api/app';
231+
* await setDockVisibility(false);
232+
* ```
233+
*
221234
* @since 2.5.0
222235
*/
223236
async function setDockVisibility(visible: boolean): Promise<void> {
224237
return invoke('plugin:app|set_dock_visibility', { visible })
225238
}
226239

240+
/**
241+
* Gets the application bundle type.
242+
*
243+
* @example
244+
* ```typescript
245+
* import { getBundleType } from '@tauri-apps/api/app';
246+
* const type = await getBundleType();
247+
* ```
248+
*
249+
* @since 2.5.0
250+
*/
227251
async function getBundleType(): Promise<BundleType> {
228252
return invoke('plugin:app|bundle_type')
229253
}

0 commit comments

Comments
 (0)