mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-16 12:54:42 +00:00
Allow array of keycombos in useKeydown
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { onBeforeUnmount } from 'vue';
|
||||
|
||||
export const useKeydown = function(keyCombo) {
|
||||
export const useKeydown = function(keyCombos) {
|
||||
let onkey = function(event) {
|
||||
if(keyCombo.key == event.key) {
|
||||
keyCombo.fn()
|
||||
let kc = keyCombos.find(({key, fn}) => key == event.key )
|
||||
if(kc) {
|
||||
kc.fn()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user