useEventListener
A function that attaches an automatically disposed event listener.
Demo
You've clicked the document 0 times
Usage
This is better utilized in elements that you don't have direct control over. Otherwise, use normal event listeners.
For example, if you want to listen to a click event on the body, and can't use <svelte:body />
, or
you have an element reference that was passed down.