Skip to content

Commit

Permalink
docs: add correct jsdoc fn description
Browse files Browse the repository at this point in the history
  • Loading branch information
EmJee1 committed Dec 16, 2023
1 parent 01c5d67 commit 9c1991a
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions renderer/composables/electron-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,11 @@ interface UseElectronRequestOptions {
}

/**
* Composable that provides a helpful wrapper around asynchronous actions.
* Returns the awaitable function; this is where you should define your asynchronous code.
* The success boolean becomes true when a single awaitable function has completed without throwing.
* Composable that provides a helpful wrapper around calls to Electron.
* Returns the execute function; this is where you can call the specified Electron method.
* @example
* const { awaitable, loading, error, success } = useAwaitable()
* const onSubmit = awaitable(async () => {
* if (name.value === '') {
* throw new Error('Name should not be empty')
* }
* await fetch('https://some-resource.com')
* })
* const { execute, response } = useElectronRequest('getArtist')
* onMounted(() => execute(route.params.id))
*/
export function useElectronRequest<T extends ElectronAPIMethod>(
method: T,
Expand Down Expand Up @@ -90,6 +84,7 @@ export function useElectronRequest<T extends ElectronAPIMethod>(

return {
execute,
loading,
response,
success,
error,
Expand Down

0 comments on commit 9c1991a

Please sign in to comment.