react-power-timers
Version:
Renderless timers
31 lines (30 loc) • 813 B
TypeScript
import * as React from 'react';
import { Component } from 'react';
import * as PropTypes from 'prop-types';
export interface ComponentProps {
timeout: number;
onTick: (progress: number) => any;
children?: (progress: number) => React.ReactNode;
}
export interface ComponentState {
tick: number;
}
export declare class Stopwatch extends Component<ComponentProps, ComponentState> {
state: {
tick: number;
};
static propTypes: {
timeout: PropTypes.Validator<any>;
onTick: PropTypes.Requireable<any>;
children: PropTypes.Requireable<any>;
};
raf: number;
timeMount: number;
componentDidMount(): void;
componentWillUnmount(): void;
tick(): void;
stop(): void;
onTick: () => void;
getProgress(): number;
render(): {};
}