How do I capture the click event of a modal when closing it without having to use jquery
similar to this link
$(document).ready(function(){
$("#myModal").modal("show");
$("#myBtn").click(function(){
$("#myModal").modal("hide");
});
$("#myModal").on('hidden.bs.modal', function () {
alert("Esta accion se ejecuta al cerrar el modal")
});
});