/** * @callback TaskCallback * @param {string} key The operation name. * @returns {Promise} */ /** * Performs an asyncronous task in a manner compatible with * the React Suspension API. * * Note, if you don't know how Suspension works, you probably * shouldn't use this function. * * This will execute the given function and throw the promise it * produces so that React.Suspense can await its completion, dismounting * your component while it completes. When the promise finishes, * React.Suspense will remount your component, invoking this function again. * At that point, this function returns the resolved value for the rest of * the life of the application. * * @param {string} key A name for this operation that is unique across * your entire application (including multiple instances of your component). * @param {TaskCallback} fn The async task to perform. * @returns {any} */ declare function suspend(key: string, fn: TaskCallback): any; declare namespace suspend { const reset: void; } export default suspend; /** * Removes a stored async result from the suspense cache, allowing * it to be invoked again on next render. * * @param {string} key The operation name to remove. */ export function resetSuspension(key: string): void; export type TaskCallback = (key: string) => Promise;