Merge pull request #74 from rhcarvalho/patch-1
Use "ui" instead of "termui" in example code
This commit is contained in:
commit
551f2e7b84
12
README.md
12
README.md
@ -93,22 +93,22 @@ Grid layout uses [12 columns grid system](http://www.w3schools.com/bootstrap/boo
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
// handle key q pressing
|
// handle key q pressing
|
||||||
termui.Handle("/sys/kbd/q", func(termui.Event) {
|
ui.Handle("/sys/kbd/q", func(ui.Event) {
|
||||||
// press q to quit
|
// press q to quit
|
||||||
termui.StopLoop()
|
ui.StopLoop()
|
||||||
})
|
})
|
||||||
|
|
||||||
termui.Handle("/sys/kbd/C-x", func(termui.Event) {
|
ui.Handle("/sys/kbd/C-x", func(ui.Event) {
|
||||||
// handle Ctrl + x combination
|
// handle Ctrl + x combination
|
||||||
})
|
})
|
||||||
|
|
||||||
termui.Handle("/sys/kbd", func(termui.Event) {
|
ui.Handle("/sys/kbd", func(ui.Event) {
|
||||||
// handle all other key pressing
|
// handle all other key pressing
|
||||||
})
|
})
|
||||||
|
|
||||||
// handle a 1s timer
|
// handle a 1s timer
|
||||||
termui.Handle("/timer/1s", func(e ui.Event) {
|
ui.Handle("/timer/1s", func(e ui.Event) {
|
||||||
t := e.Data.(termui.EvtTimer)
|
t := e.Data.(ui.EvtTimer)
|
||||||
// t is a EvtTimer
|
// t is a EvtTimer
|
||||||
if t.Count%2 ==0 {
|
if t.Count%2 ==0 {
|
||||||
// do something
|
// do something
|
||||||
|
Loading…
Reference in New Issue
Block a user