jsPollKeys polls the keys collected by the javascript callback this ensures the keys only get updated once per frame, since the callback has no information about the frames and is invoked several times between frames. This makes Input.Button.JustPressed and JustReleased able to return true properly.
()
| 319 | // times between frames. This makes Input.Button.JustPressed and JustReleased |
| 320 | // able to return true properly. |
| 321 | func jsPollKeys() { |
| 322 | pollLock.Lock() |
| 323 | defer pollLock.Unlock() |
| 324 | |
| 325 | Input.Modifier = mod |
| 326 | for key, state := range poll { |
| 327 | Input.keys.Set(Key(key), state) |
| 328 | delete(poll, key) |
| 329 | } |
| 330 | |
| 331 | } |
| 332 | |
| 333 | func checkModifiers(event js.Value) { |
| 334 | mod = 0 |
no test coverage detected