init
commit
fe8d0dfc9b
|
@ -0,0 +1,18 @@
|
|||
*.min.js
|
||||
*.min.css
|
||||
index.html
|
||||
.vscode
|
||||
node_modules/
|
||||
dist/
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
package-lock.json
|
||||
|
||||
|
||||
._*
|
||||
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
*
|
||||
* @author yutent<yutent.io@gmail.com>
|
||||
* @date 2020/10/29 16:48:26
|
||||
*/
|
||||
|
||||
import KEY_DICT from './key.dict.js'
|
||||
|
||||
var log = console.log
|
||||
|
||||
function keydown(ev) {
|
||||
var { code, keyCode } = ev
|
||||
|
||||
// log(ev.keyCode, ev.code, KEYCODE_DICT[keyCode])
|
||||
}
|
||||
|
||||
export default class Keyboard {
|
||||
constructor() {
|
||||
this.__EVENTS__ = {}
|
||||
document.addEventListener('keydown', keydown, false)
|
||||
}
|
||||
|
||||
destroy() {
|
||||
delete this.__EVENTS__
|
||||
document.removeEventListener('keydown', keydown, false)
|
||||
}
|
||||
|
||||
on(action, callback) {
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
export default {
|
||||
'0': 48, // Digit{N}, Numpad{N}
|
||||
'1': 49,
|
||||
'2': 50,
|
||||
'3': 51,
|
||||
'4': 52,
|
||||
'5': 53,
|
||||
'6': 54,
|
||||
'7': 55,
|
||||
'8': 56,
|
||||
'9': 57,
|
||||
"'": 222,
|
||||
'*': 106,
|
||||
'+': 107,
|
||||
',': 188,
|
||||
'-': [109, 189],
|
||||
'.': [110, 190],
|
||||
'/': [111, 191],
|
||||
';': 186,
|
||||
'=': 187,
|
||||
'[': 219,
|
||||
'\\': 220,
|
||||
']': 221,
|
||||
'`': 192,
|
||||
a: 65,
|
||||
b: 66,
|
||||
c: 67,
|
||||
d: 68,
|
||||
e: 69,
|
||||
f: 70,
|
||||
g: 71,
|
||||
h: 72,
|
||||
i: 73,
|
||||
j: 74,
|
||||
k: 75,
|
||||
l: 76,
|
||||
m: 77,
|
||||
n: 78,
|
||||
o: 79,
|
||||
p: 80,
|
||||
q: 81,
|
||||
r: 82,
|
||||
s: 83,
|
||||
t: 84,
|
||||
u: 85,
|
||||
v: 86,
|
||||
w: 87,
|
||||
x: 88,
|
||||
y: 89,
|
||||
z: 90,
|
||||
enter: 13, // Enter, NumpadEnter
|
||||
shift: 16, // ShiftLeft, ShiftRight
|
||||
ctrl: 17, // ControlLeft, ControlRight
|
||||
alt: 18, // AltLeft, AltRight
|
||||
space: 32,
|
||||
super: 91, // MetaLeft, MetaRight
|
||||
tab: 9,
|
||||
backspace: 8,
|
||||
numlock: 12,
|
||||
capslock: 20,
|
||||
escape: 27,
|
||||
contextmenu: 93,
|
||||
insert: 45,
|
||||
delete: 46,
|
||||
pagedown: 34,
|
||||
pageup: 33,
|
||||
home: 36,
|
||||
end: 35,
|
||||
up: 38,
|
||||
down: 40,
|
||||
left: 37,
|
||||
right: 39,
|
||||
f1: 112,
|
||||
f2: 113,
|
||||
f3: 114,
|
||||
f4: 115,
|
||||
f5: 116,
|
||||
f6: 117,
|
||||
f7: 118,
|
||||
f8: 119,
|
||||
f9: 120,
|
||||
f10: 121,
|
||||
f11: 122,
|
||||
f12: 123,
|
||||
f13: 124, // Print键
|
||||
f14: 125, // Screen键
|
||||
f15: 126 // Pause键
|
||||
}
|
Loading…
Reference in New Issue