mirror of
https://github.com/directus/directus.git
synced 2026-02-15 14:54:56 -05:00
useShortcut
function useShortcut(
shortcut: string | string[],
handler: handler: (evt?: ExtendedKeyboardEvent, combo?: string) => void
): void
Can be used to attach a global keyboard shortcut to a function. Removes the shortcut once the current component unmounts
Usage
import { defineComponent } from '@vue/composition-api';
import { useShortcut } from '@/composables/use-shortcut';
export default defineComponent({
setup(props) {
useShortcut('mod+s', save);
function save() {
// ...
}
}
});