12 lines
233 B
JavaScript
12 lines
233 B
JavaScript
|
/**
|
||
|
*
|
||
|
* @param {string} keyToListen
|
||
|
* @param {()=>void} callback
|
||
|
*/
|
||
|
export const onDocumentKeyUp = (keyToListen, callback) => {
|
||
|
document.addEventListener(
|
||
|
"keyup",
|
||
|
({ key }) => key === keyToListen && callback()
|
||
|
);
|
||
|
};
|