Skip to content

Commit

Permalink
docs: 修改useTimeout 方法返回类型方式
Browse files Browse the repository at this point in the history
  • Loading branch information
79E committed Dec 31, 2022
1 parent 4911985 commit d3a7afd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks/use-timeout.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { useRef, useCallback } from 'react';

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

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

const clearTimer = useCallback(() => {
Expand Down

0 comments on commit d3a7afd

Please sign in to comment.