I'm looking for an event which combines all other events which fall under the user-page interactions category. This would include click, mousedown, mouseup, keydown, keyup and so on. In short, an "interaction" would be any event after which the script will be allowed to play audio, or writeText()
to the clipboard
.
I'm looking something like this...
window.addEventListener("interaction", async () => {
await navigator.clipboard.writeText("Copied some text");
}, { once: true });
... As opposed to looping through ["click, "keyup"...]
and creating a separate event listener for each.