developerasun / myCodeBox-web

Open source code box for web developers.
Apache License 2.0
5 stars 0 forks source link

[RESEARCH] Client/Svelte : event modifier #243

Open developerasun opened 2 years ago

developerasun commented 2 years ago

topic : understanding event modifier in Svelte

read this

  1. preventDefault — calls event.preventDefault() before running the handler. Useful for client-side form handling, for example.
  2. stopPropagation — calls event.stopPropagation(), preventing the event reaching the next element
  3. passive — improves scrolling performance on touch/wheel events (Svelte will add it automatically where it's safe to do so)
  4. nonpassive — explicitly set passive: false
  5. capture — fires the handler during the capture phase instead of the bubbling phase (MDN docs)
  6. once — remove the handler after the first time it runs
  7. self — only trigger handler if event.target is the element itself
  8. trusted — only trigger handler if event.isTrusted is true. I.e. if the event is triggered by a user action.

reference