Created Keyboard API (markdown)

Jakub Sobon 2019-02-24 17:35:32 -05:00
parent 92e1d764f9
commit 538a383642
1 changed files with 25 additions and 0 deletions

25
Keyboard-API.md Normal file

@ -0,0 +1,25 @@
# Keyboard API
[![Doc Status](https://godoc.org/github.com/mum4k/termdash/keyboard?status.png)](https://godoc.org/github.com/mum4k/termdash/keyboard)
The [keyboard](https://github.com/mum4k/termdash/tree/master/keyboard) package exposes types that represent keys on the keyboard.
This is a data-only package which provides types that are accepted by the infrastructure and widgets in multiple locations.
The public API surface of this package consists of the following:
## [keyboard.Key](https://github.com/mum4k/termdash/blob/b8591308b93dbd58d97e3a83998e180ecc17cf11/keyboard/keyboard.go#L18-L22)
The **keyboard.Key** type represents keys on the keyboard. The package provides predefined values for some of the keys which can be used directly, e.g:
```go
var key Keyboard
key = keyboard.KeyEnter
```
For all other keys like regular letters, the character that represents the letter can be directly assigned to the Key type.
```go
var key Keyboard
key = 'a'
```