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

View File

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