Remove ts/services/timers.ts

This commit is contained in:
Fedor Indutny
2021-10-06 14:59:34 -07:00
committed by GitHub
parent 26eabf16a8
commit a537204fc0
10 changed files with 38 additions and 144 deletions

View File

@@ -4,7 +4,6 @@
import React, { KeyboardEvent, MouseEvent, ReactNode, useEffect } from 'react';
import classNames from 'classnames';
import { createPortal } from 'react-dom';
import { onTimeout, removeTimeout } from '../services/timers';
import { useRestoreFocus } from '../hooks/useRestoreFocus';
export type PropsType = {
@@ -48,11 +47,11 @@ export const Toast = ({
return;
}
const timeoutId = onTimeout(Date.now() + timeout, onClose);
const timeoutId = setTimeout(onClose, timeout);
return () => {
if (timeoutId) {
removeTimeout(timeoutId);
clearTimeout(timeoutId);
}
};
}, [autoDismissDisabled, onClose, root, timeout]);