Keyboard input/Keypress check: Difference between revisions
Content added Content deleted
Line 720: | Line 720: | ||
time.Sleep(500 * time.Millisecond) |
time.Sleep(500 * time.Millisecond) |
||
}</lang> |
}</lang> |
||
You don't need external dependencies to achieve this.You can use a channel and set a timeout on it. |
You don't need external dependencies to achieve this. You can use a channel and set a timeout on it. |
||
::<lang go>package main |
::<lang go>package main |
||
// stackoverflow.com/questions/43965556/how-to-read-a-key-in-go-but-continue-application-if-no-key-pressed-within-x-seco |
// stackoverflow.com/questions/43965556/how-to-read-a-key-in-go-but-continue-application-if-no-key-pressed-within-x-seco |