switch to manager for toasts

toast
Kit Kasune 3 years ago
parent 2d20c2a479
commit e20fd331ef
  1. 6
      scripts/startup/preload.js
  2. 7
      scripts/toast/createtoast.js

@ -23,7 +23,11 @@ window.addEventListener('DOMContentLoaded', () => {
name: "Alpha",
semver: require('../../package.json').version
},
platform: undefined
platform: undefined,
toasts: {
total: 0,
shown: []
}
};
const platform = ipcRenderer.sendSync('preload', 'request-platform');

@ -40,7 +40,12 @@ module.exports = (name, text, bg = '#a172a6', persistOnClick = false, time = 5,
timer.style.backgroundColor = timerColor;
timer.style.animation = `toast-timer ${time}s linear`;
toastWrap.appendChild(timer);
//toast.onmouseenter = () => {timer.style.animationPlayState = 'paused';};
toast.id = `toast-${window.kade.toasts.total}`;
//toast.onmouseleave = () => {timer.style.animationPlayState = 'normal';};
setTimeout(() => {if (continueTimeout) {removeToast(toast);}}, time * 1000);
window.kade.toasts.shown[window.kade.toasts.total] = {
timer,
toast,
};
window.kade.toasts.total++;
};
Loading…
Cancel
Save