@ckeditor/ckeditor5-vue
Version:
Official Vue.js 3+ component for CKEditor 5 – the best browser-based rich text editor.
38 lines (37 loc) • 1.09 kB
TypeScript
/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/
import { type ComputedRef, type Ref } from 'vue';
/**
* A composable that executes an async function and provides the result.
*
* @param asyncFunc The async function to execute.
* @returns The result of the async function.
* @example
*
* ```ts
* const { loading, data, error } = useAsync( async () => {
* const response = await fetch( 'https://api.example.com/data' );
* return response.json();
* } );
* ```
*/
export declare const useAsync: <R>(asyncFunc: () => Promise<R>) => AsyncComposableResult<R>;
/**
* The result of the `useAsync` composable.
*/
export type AsyncComposableResult<R> = {
/**
* Whether the async function is currently loading.
*/
loading: ComputedRef<boolean>;
/**
* The data returned by the async function.
*/
data: Ref<R | null>;
/**
* The error thrown by the async function.
*/
error: Ref<Error | null>;
};