Self-hosted email delivery platform that enables applications to send emails via HTTP APIs while handling SMTP delivery, templates, storage, security, and analytics. Fully self-hostable alternative to services like SendGrid or Mailgun.
Go email-relayemail-routinghttp-to-smtpmail-deliverymailchimp-alternativemailgun-alternativemailsendermailservermailtemplatemailtestpostmark-alternativesend-emailsendgrid-alternativesendmailtransactional-emailtransactional-outbox
import { ref, onMounted, onUnmounted } from 'vue';
export function useModalSafeClose(closeAction: () => void) {
const isClickStartingOnOverlay = ref(false);
const watchClickStart = (event: MouseEvent): void => {
isClickStartingOnOverlay.value = event.target === event.currentTarget;
};
const confirmClickEnd = (event: MouseEvent): void => {
const isClickEndingOnOverlay = event.target === event.currentTarget;
if (isClickStartingOnOverlay.value && isClickEndingOnOverlay) {
closeAction();
}
isClickStartingOnOverlay.value = false;
};
const handleKeyDown = (event: KeyboardEvent): void => {
if (event.key === 'Escape') {
closeAction();
}
};
onMounted(() => {
document.addEventListener('keydown', handleKeyDown);
});
onUnmounted(() => {
document.removeEventListener('keydown', handleKeyDown);
});
return {
watchClickStart,
confirmClickEnd
};
}