KeyboardJS - "构建你的应用吧,我会处理按键"
KeyboardJS - "构建你的应用吧,我会处理按键"
太阳火神的美丽人生 (http://blog.csdn.net/opengl_es)
本文遵循“署名-非商业用途-保持一致”创作公用协议
KeyboardJS
"Build your app, I‘ll handle the keys."
Demo
What is KeyboardJS?
Get it Here
Language Support
If you create a new locale please consider sending me a pull request or submit it to the issue tracker so I can add it to the library.
Methods
KeyboardJS.on
Usage
Both the onUpCallback and the onUpCallback are passed three arguments. The first is the key event, the second is the keys pressed, and the third is the key combo string.
Returned
- clear() - Removes the key or key combo binding.
- on() - Allows you to bind to the keyup and keydown event of the given combo. An alternative to adding the onDownCallback and onUpCallback.
KeyboardJS.activeKeys
Usage
Returned
KeyboardJS.clear
Usage
Please note that if you are just trying to remove a single binding should use the clear method in the object returned by KeyboardJS.on instead of this. This function is for removing all binding that use a certain key.
KeyboardJS.clear.key
Usage
KeyboardJS.locale
Usage
KeyboardJS.locale.register
Usage
Definitions
keyCombo
examples
- ‘a‘ - binds to the ‘a‘ key. Pressing ‘a‘ will match this keyCombo.
- ‘a, b‘ - binds to the ‘a‘ and ‘b‘ keys. Pressing either of these keys will match this keyCombo.
- ‘a b‘ - binds to the ‘a‘ and ‘b‘ keys. Pressing either of these keys will match this keyCombo.
- ‘a + b‘ - binds to the ‘a‘ and ‘b‘ keys. Pressing both of these keys will match this keyCombo.
- ‘a > b‘ - binds to the ‘a‘ and ‘b‘ keys. Pressing ‘a‘ then ‘b‘ will match this keyCombo.
- ‘a + b, c + d‘ - binds to the ‘a‘, ‘b‘, ‘c‘ and ‘d‘ keys. Pressing either the ‘a‘ key and the ‘b‘ key, or the ‘c‘ and the ‘d‘ key will match this keyCombo.
- ‘a + b > c + d‘ - binds to the ‘a‘, ‘b‘, ‘c‘ and ‘d‘ keys. Pressing both the ‘a‘ key and the ‘b‘ key, then both the ‘c‘ and the ‘d‘ key will match this keyCombo.
localeDefinitions
examples
- { "map": { "65": ["a"], "66": ["b"], ... }, "macros": [ ["shift + `", ["tilde", "~"]], ["shift + 1", ["exclamation", "!"]], .... ] }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。