mami/src/mami.js/awaitable.js
flash cf71bab92d Rewrote connection handling.
This has been in the works for over a month and might break things because it's a very radical change.
If it causes you to be unable to join chat, report it on the forum or try joining using the legacy chat on https://sockchat.flashii.net.
2024-04-17 15:42:50 +00:00

20 lines
558 B
JavaScript

const MamiSleep = durationMs => new Promise(resolve => { setTimeout(resolve, durationMs); });
const MamiWaitVisible = () => {
return new Promise(resolve => {
if(document.visibilityState === 'visible') {
resolve();
return;
}
const handler = () => {
if(document.visibilityState === 'visible') {
window.removeEventListener('visibilitychange', handler);
resolve();
}
};
window.addEventListener('visibilitychange', handler);
});
};