gohook/test/main.go
htmk 11eee3201f Part 2 of making the lib async
- New event struct mimiking C structs
 - changed c channel library to eb_chan
 - changed API to something more palatable
2019-02-08 20:26:02 -02:00

30 lines
390 B
Go

package main
import (
"fmt"
"time"
"github.com/cauefcr/gohook"
)
func main() {
s := hook.Start()
tout := time.After(time.Second * 10)
done := false
for !done {
select {
case i := <-s:
if i.Keychar == uint16('q') {
tout = time.After(1 * time.Millisecond)
}
fmt.Printf("%+v\n", i)
case <-tout:
fmt.Print("Done.")
done = true
break;
}
}
hook.End()
}