meet-hour-react-interval-hook
Version:
React hook for using self-correcting setInterval, augmented by management methods (start, stop, isActive) and also using React Class Based Component
34 lines (33 loc) • 988 B
TypeScript
import React from 'react';
import PropTypes from 'prop-types';
interface Props {
enabled: boolean;
timeout: number;
}
declare type Prpss = {
enabled: boolean;
timeout: number;
callback?: Function;
};
export declare class ReactInterval extends React.Component<Props> {
timer: null | ReturnType<typeof setTimeout>;
static defaultProps: {
enabled: boolean;
timeout: number;
};
static propTypes: {
callback: PropTypes.Validator<(...args: any[]) => any>;
enabled: PropTypes.Requireable<boolean>;
timeout: PropTypes.Requireable<number>;
};
constructor(props: Props);
componentDidMount(): void;
shouldComponentUpdate({ timeout, callback, enabled }: Prpss): boolean;
componentDidUpdate({ enabled, timeout }: Prpss): void;
componentWillUnmount(): void;
callback: () => void;
start: () => void;
stop: () => void;
render: () => boolean;
}
export {};