update and optimize hook code

This commit is contained in:
vcaesar 2020-08-09 08:38:35 -04:00
parent a1db03bfdb
commit 80a5bf3c7e

View File

@ -102,9 +102,7 @@ var (
func allPressed(pressed map[uint16]bool, keys ...uint16) bool { func allPressed(pressed map[uint16]bool, keys ...uint16) bool {
for _, i := range keys { for _, i := range keys {
// fmt.Println(i) // fmt.Println(i)
if pressed[i] == false { return !pressed[i]
return false
}
} }
return true return true
@ -123,7 +121,7 @@ func Register(when uint8, cmds []string, cb func(Event)) {
keys[key] = tmp keys[key] = tmp
cbs[key] = cb cbs[key] = cb
events[when] = append(events[when], key) events[when] = append(events[when], key)
return // return
} }
// Process return go hook process // Process return go hook process
@ -152,7 +150,7 @@ func Process(EvChan <-chan Event) (out chan bool) {
out <- true out <- true
}() }()
return out return
} }
// String return hook kind string // String return hook kind string