Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a slight delay before highlighting neighbors
This aims to cut down, at least a little bit, on unnecessary server requests. Otherwise we're just always processing 2 server requests per click... so we're trying to get that o be 1 request per click, as often as possible, while still preserving that "fast" Game play dynamic. The 100 ms delay I've settled on attempts to thread the needle between being: 1. Just enough time for a fast-ish click event to occur (canceling the highlightNeighbors request), while also being 2. Not too long™--so that it doesn't feelt delayed or too annoying to wait for the Cell highlight effect to appear. Notes: I chose to add a `mouseup` event handler to cancel the timer because: 1. `mouseup` occurs before `click`, so this gives us maybe an extra millisecond or 2 of extra leeway. 2. It reduces the responsibilities on the dispatchClick event. 3. I expect to add more to the `mouseup` event soon. I've also considered making a lead-in Highlight effect with local JS, which would then be supplanted by the server response (if we get that far). While this could work... I don't want to lose that interactive/responsive/exciting Game play experience for other participants either. Reducing the ratio of highlight events transmitted vs seen on the originating User's side might start to erode that line a bit.
- Loading branch information