Remove ts/services/timers.ts
This commit is contained in:
parent
26eabf16a8
commit
a537204fc0
10 changed files with 38 additions and 144 deletions
|
@ -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]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue