update godoc and example

This commit is contained in:
vcaesar 2020-12-02 13:01:20 -04:00
parent 05ca764c42
commit 4f8581a884
2 changed files with 5 additions and 5 deletions

View File

@ -6,14 +6,14 @@ import (
hook "github.com/robotn/gohook"
)
func addEvent() {
func registerEvent() {
fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
hook.Register(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
fmt.Println("ctrl-shift-q")
hook.End()
})
fmt.Println("--- Please press w---")
fmt.Println("--- Please press w ---")
hook.Register(hook.KeyDown, []string{"w"}, func(e hook.Event) {
fmt.Println("w-")
})
@ -54,7 +54,7 @@ func base() {
}
func main() {
addEvent()
registerEvent()
base()

View File

@ -156,7 +156,7 @@ func Process(evChan <-chan Event) (out chan bool) {
return
}
// String return hook kind string
// String return formatted hook kind string
func (e Event) String() string {
switch e.Kind {
case HookEnabled:
@ -202,7 +202,7 @@ func (e Event) String() string {
return fmt.Sprintf("%v - Event: {Kind: FakeEvent}", e.When)
}
return "Unknown event, contact the mantainers"
return "Unknown event, contact the mantainers."
}
// RawcodetoKeychar rawcode to keychar