Merge pull request #74 from rhcarvalho/patch-1

Use "ui" instead of "termui" in example code
This commit is contained in:
Zack Guo 2015-12-26 11:50:10 -05:00
commit 551f2e7b84
1 changed files with 6 additions and 6 deletions

View File

@ -93,22 +93,22 @@ Grid layout uses [12 columns grid system](http://www.w3schools.com/bootstrap/boo
```go
// handle key q pressing
termui.Handle("/sys/kbd/q", func(termui.Event) {
ui.Handle("/sys/kbd/q", func(ui.Event) {
// 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
})
termui.Handle("/sys/kbd", func(termui.Event) {
ui.Handle("/sys/kbd", func(ui.Event) {
// handle all other key pressing
})
// handle a 1s timer
termui.Handle("/timer/1s", func(e ui.Event) {
t := e.Data.(termui.EvtTimer)
ui.Handle("/timer/1s", func(e ui.Event) {
t := e.Data.(ui.EvtTimer)
// t is a EvtTimer
if t.Count%2 ==0 {
// do something