Skip to content

Commit

Permalink
add metadata for keydown events
Browse files Browse the repository at this point in the history
  • Loading branch information
sorax committed Sep 2, 2024
1 parent 2479c36 commit ea00a2d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("
let liveSocket = new LiveSocket("/live", Socket, {
hooks: Hooks,
longPollFallbackMs: 2500,
params: { _csrf_token: csrfToken }
params: { _csrf_token: csrfToken },
metadata: {
keydown: (e, el) => {
return {
key: e.key,
metaKey: e.metaKey,
repeat: e.repeat
}
}
}
})

// Show progress bar on live navigation and form submits
Expand Down

0 comments on commit ea00a2d

Please sign in to comment.