Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
CaiSijian authored Jun 5, 2024
1 parent 79bf6e4 commit bd21e7b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**@type {HTMLDivElement} */
const h1 = document.querySelector('h1')
const h2 = document.querySelector('h2')
h1.innerText='0.1.3'
h2.innerText='current event name'
h1.innerText = '0.1.3'
h2.innerText = 'current event name'
const input = document.querySelector('input')
const textarea = document.querySelector('textarea')
input.addEventListener('keydown', handler)
Expand All @@ -13,8 +13,9 @@ window.addEventListener('keydown', handler)
* @param {MouseEvent} event
*/
function handler(event) {
h2.innerText=this===window ? 'window' :'input'
const { ctrlKey,shiftKey,altKey,metaKey, code,key,keyCode} = event
const info={ ctrlKey,shiftKey,altKey,metaKey, code,key,keyCode}
textarea.value = JSON.stringify(info,undefined,4)
h2.innerText = this === window ? 'window' : 'input'
const eventName = this === window ? 'window' : 'input'
const { ctrlKey, shiftKey, altKey, metaKey, code, key, keyCode } = event
const info = { ctrlKey, shiftKey, altKey, metaKey, code, key, keyCode }
textarea.value = `${eventName} ${JSON.stringify(info, undefined, 4)} \n\r${textarea?.value}`
}

0 comments on commit bd21e7b

Please sign in to comment.