UNPKG

1.19 kBTypeScriptView Raw
1/// <reference types="react" />
2export declare function elementIsOrContains(element: HTMLElement, testElement: HTMLElement): boolean;
3/**
4 * Throttle an event on an EventTarget by wrapping it in a
5 * `requestAnimationFrame` call. Returns the event handler that was bound to
6 * given eventName so you can clean up after yourself.
7 *
8 * @see https://developer.mozilla.org/en-US/docs/Web/Events/scroll
9 */
10export declare function throttleEvent(target: EventTarget, eventName: string, newEventName: string): (event: Event) => void;
11export interface IThrottledReactEventOptions {
12 preventDefault?: boolean;
13}
14/**
15 * Throttle a callback by wrapping it in a `requestAnimationFrame` call. Returns
16 * the throttled function.
17 *
18 * @see https://www.html5rocks.com/en/tutorials/speed/animations/
19 */
20export declare function throttleReactEventCallback<E extends React.SyntheticEvent = React.SyntheticEvent>(callback: (event: E, ...otherArgs: any[]) => any, options?: IThrottledReactEventOptions): (event2: E) => void;
21/**
22 * Throttle a method by wrapping it in a `requestAnimationFrame` call. Returns
23 * the throttled function.
24 */
25export declare function throttle<T extends Function>(method: T): T;