// Type definitions for react-wait 0.3 // Project: https://github.com/f/react-wait#readme // Definitions by: Ifiok Jr. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { ComponentType, FunctionComponent } from 'react'; export const Waiter: FunctionComponent; export interface WaitProps { fallback: JSX.Element; on: string; } export interface UseWaitAPI { /** * Using Wait Component * * ```tsx * function Component() { * const { Wait } = useWait(); * return ( * Waiting...}> * The content after waiting done * * ); * } * ``` * * Better example for a button with loading state: * ```tsx * * ``` */ Wait: ComponentType; /** * Returns boolean value if any loader exists in context. * * ```tsx * const { anyWaiting } = useWait(); * return ; * ``` */ anyWaiting(): boolean; /** * Returns boolean value if given loader exists in context. * * ```tsx * const { isWaiting } = useWait(); * return ( * * ); * ``` */ isWaiting(waiter: string): boolean; /** * Starts the given waiter. * * ```tsx * const { startWaiting } = useWait(); * return ; * ``` */ startWaiting(waiter: string): void; /** * Stops the given waiter. * * ```tsx * const { end } = useWait(); * return ; * ``` */ endWaiting(waiter: string): void; } export function useWait(): UseWaitAPI;