Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.17 KB

README.md

File metadata and controls

48 lines (33 loc) · 1.17 KB

tinyjs-plugin-keyboard

KeyboardManager

查看demo

http://tinyjs.net/plugins/tinyjs-plugin-keyboard.html#demo

引用方法

起步

首先当然是要引入,推荐NPM方式,当然你也可以使用CDN或下载独立版本,先从几个例子入手吧!

1、最简单的例子

引用 Tiny.js 源码

<script src="https://gw.alipayobjects.com/os/lib/tinyjs/tiny/1.2.3/tiny.js"></script>
var Keyboard = require('tinyjs-plugin-keyboard');
// 或者
// import Keyboard from 'tinyjs-plugin-keyboard';

var keySpace = new Keyboard(32);
keySpace.press = function (e) {
  console.log('space pressed!')
}
keySpace.release = function (e) {
  console.log('space released!')
}

依赖

API文档

http://tinyjs.net/plugins/tinyjs-plugin-keyboard.html#docs