Customizing Event


RESETRUNFULL
<!DOCTYPE html><html><head></head><body>
    <script>
        document.addEventListener("timeout",()=>{
            alert(`Time's Up: started at
                       ${new Date(event.detail.startTS)}`);
        })
        setTimeout(()=>{
            var ev = new CustomEvent("timeout",
                                       {detail:{startTS:Date.now()}});
            document.dispatchEvent(ev);
        },3000);
    </script></body></html>