UNPKG

@revoloo/cypress6

Version:

Cypress.io end to end testing tool

11 lines (8 loc) 258 B
import * as React from 'react' import hotkeys from 'hotkeys-js' export function useGlobalHotKey (shortcut: string, handler: () => void) { React.useEffect(() => { hotkeys(shortcut, handler) return () => hotkeys.unbind(shortcut) }, [shortcut]) }