Skip to content

Commit d3a7afd

Browse files
committed
docs: 修改useTimeout 方法返回类型方式
1 parent 4911985 commit d3a7afd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/hooks/use-timeout.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { useRef, useCallback } from 'react';
22

3-
interface IUseTimeoutReturn {
3+
type UseTimeoutReturn = {
44
/** 启动计时器,入参为延时到期的回调函数 */
55
startTimer: (callback: () => void, delay?: number) => void;
66
/** 清楚计时器 */
77
clearTimer: {};
8-
}
8+
};
99

1010
/**
1111
* 延迟调用
1212
* @returns 返回开始定时器和清楚定时器的方法
1313
*/
14-
const useTimeout = (): IUseTimeoutReturn => {
14+
export const useTimeout = (): UseTimeoutReturn => {
1515
const timerRef = useRef<any>(null);
1616

1717
const clearTimer = useCallback(() => {

0 commit comments

Comments
 (0)