Trying to build a prototype where a (1) single press on keyboard arrow left/right animates one way and (2) long press (arrow press and hold) animates a different way.
So far the idea I tried is to sniff for keyboard events with
Events.wrap(window).addEventListener 'keyup', (event)
which only fires when the key is up - works great for single key presses
Events.wrap(window).addEventListener 'keydown', (event) which fires continuously when the arrow is depressed
The problem though is when I release the arrow after long press the "keyup" fires which is what I want to avoid.
How do I remove the event listener for "keyup" while "keydown" is firing? I tried Events.wrap(window).removeEventListener 'keyup' but is does not work. Layer. off() does not work either cause they keyboard events are attached to "window" not a particular layer.
Any ideas how to differentiate between single and long keyboard presses better?