UNPKG
@revoloo/cypress6
Version:
latest (1.0.0)
1.0.0
Cypress.io end to end testing tool
github.com/cypress-io/cypress
cypress-io/cypress
@revoloo/cypress6
/
packages
/
runner-ct
/
src
/
lib
/
useHotKey.ts
11 lines
(8 loc)
•
258 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
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]) }