Skip to content

Commit

Permalink
added .visual modifier to x-on to bind to window.visualViewport
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred Lau committed Aug 23, 2024
1 parent ab743bc commit 2b32333
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/alpinejs/src/utils/on.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function on (el, event, modifiers, callback) {
if (modifiers.includes('capture')) options.capture = true
if (modifiers.includes('window')) listenerTarget = window
if (modifiers.includes('document')) listenerTarget = document
if (modifiers.includes('visual')) listenerTarget = window.visualViewport

// By wrapping the handler with debounce & throttle first, we ensure that the wrapping logic itself is not
// throttled/debounced, only the user's callback is. This way, if the user expects
Expand Down

0 comments on commit 2b32333

Please sign in to comment.