Source Code: (back to article)
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<input type="text">
</textarea>
<script>
let inputText = document.querySelector('input');
inputText.addEventListener('awesome', e => alert(e.detail.text()));
inputText.addEventListener('input', function() {
this.dispatchEvent(new CustomEvent('awesome', {
bubbles: true,
detail: {
text: () => inputText.value
}
}))
});
</script>
</body>
</html>