@spark-ui/internal-utils
Version:
package for sharing reusable code and resources across the codebase
13 lines (12 loc) • 354 B
TypeScript
type AnyFunction = (...args: any[]) => any;
interface Options {
/**
* Whether to use queueMicrotask or not
*/
sync?: boolean;
}
/**
* Returns a memoized callback that will queueMicrotask the callback if sync is true
*/
declare function useEvent<T extends AnyFunction>(callback: T | undefined, opts?: Options): T;
export { useEvent };