butter-toast
Version:
Smooth toast notifications for react apps
7 lines (6 loc) • 307 B
JavaScript
export const isSticky = (toast = {}) => toast.sticky || toast.timeout === Infinity;
// if no `remaining`, just use the toast's timeout
export const calcNextTimeout = (remaining, timeout) => {
const next = typeof remaining === 'number' ? remaining : timeout;
return next < 200 ? 200 + next : next;
}