UNPKG

@aotimme/urql-exchange-refetch-interval

Version:

An exchange that allows refetching queries at a specified interval

28 lines (25 loc) 786 B
import { Operation, Exchange } from '@urql/core'; /** Input parameters for the {@link refetchIntervalExchange}. */ interface Options { /** * The time to wait before refetching a query, in milliseconds. * * @defaultValue `300_000` - 5 min */ refetchInterval?: boolean | number | ((op: Operation) => number | boolean); } /** Exchange factory that refetches all queries on an interval. * * @param options - An {@link Options} configuration object. * @returns the created refetch-interval {@link Exchange}. * * @example * ```ts * refetchIntervalExchange({ * // Refetch every second. * refetchInterval: 1000, * }); * ``` */ declare const refetchIntervalExchange: (options: Options) => Exchange; export { type Options, refetchIntervalExchange };