@yoda/input

Input events handler. On YodaOS, every input events are treated as an event and handled by InputEvent. Currently, we support keyup, keydown and longpress events.

Classes

InputEvent

Methods

(inner) defaults() → {input.InputEvent}

get the event handler

Returns:
Type:
input.InputEvent
Example
var inputEvent = require('input')()
inputEvent.on('keyup', (event) => {
  console.log('keyup', event.keyCode)
})
inputEvent.on('click', (event) => {
  console.log('click', event.keyCode)
})
inputEvent.on('dbclick', (event) => {
  console.log('double click', event.keyCode)
})
inputEvent.on('keydown', (event) => {
  console.log('keydown', event.keyCode)
})
inputEvent.on('longpress', (event) => {
  console.log('longpressx', event.keyCode)
})