Skip to content

Commit 242bb48

Browse files
committed
refactor(useKeydown): rename autoStart option to immediate
1 parent 3513489 commit 242bb48

File tree

1 file changed

+3
-3
lines changed
  • packages/0/src/composables/useKeydown

1 file changed

+3
-3
lines changed

packages/0/src/composables/useKeydown/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface KeyHandler {
1010
}
1111

1212
export interface UseKeydownOptions {
13-
autoStart?: boolean
13+
immediate?: boolean
1414
}
1515

1616
let globalListener: ((event: KeyboardEvent) => void) | null = null
@@ -52,7 +52,7 @@ function stopGlobalListener () {
5252
*/
5353

5454
export function useKeydown (handlers: KeyHandler[] | KeyHandler, options: UseKeydownOptions = {}) {
55-
const { autoStart = true } = options
55+
const { immediate = true } = options
5656
const keyHandlers = Array.isArray(handlers) ? handlers : [handlers]
5757
const handlerIds = ref<ID[]>([])
5858
const isListening = ref(false)
@@ -89,7 +89,7 @@ export function useKeydown (handlers: KeyHandler[] | KeyHandler, options: UseKey
8989
}
9090
}
9191

92-
if (getCurrentScope() && autoStart) {
92+
if (getCurrentScope() && immediate) {
9393
onMounted(startListening)
9494
}
9595

0 commit comments

Comments
 (0)