mirror of https://github.com/gizak/termui.git
Now keyboard events will be handled in order, but the consequence is computation-intense may need to be moved to a seperate goroutine otherwise it may delay the next event call.
This commit is contained in:
parent
383c12d69e
commit
86c275c69b
|
@ -126,7 +126,7 @@ func hookTermboxEvt() {
|
||||||
e := termbox.PollEvent()
|
e := termbox.PollEvent()
|
||||||
|
|
||||||
for _, c := range sysEvtChs {
|
for _, c := range sysEvtChs {
|
||||||
go func(ch chan Event) {
|
func(ch chan Event) {
|
||||||
ch <- crtTermboxEvt(e)
|
ch <- crtTermboxEvt(e)
|
||||||
}(c)
|
}(c)
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ func (es *EvtStream) Loop() {
|
||||||
case "/sig/stoploop":
|
case "/sig/stoploop":
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
go func(a Event) {
|
func(a Event) {
|
||||||
es.RLock()
|
es.RLock()
|
||||||
defer es.RUnlock()
|
defer es.RUnlock()
|
||||||
if pattern := es.match(a.Path); pattern != "" {
|
if pattern := es.match(a.Path); pattern != "" {
|
||||||
|
|
Loading…
Reference in New Issue