fix bug with redundant play/pause events and with displaying current mod #157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resuming the timer failed to check if the
ticking
variable was a non-null reference before re-assigning. I believe this was leading to weird behavior where the user could fire off play/pause events with a certain timing that would eventually fail to stop an instance ofticking
(because there are multiple in memory) and cause the "end timer" event to be fired, even though it appears to be paused. We can see that below - the timer is displayed as paused at 17.3 seconds. The last message we received from the server was a pause timer event. Yet then we receive the end timer event and are prompted with such.Stopping the timer now nulls
ticking
and resuming the timer will check ifticking
is null before restoring a reference.We also fixed a bug where we were looking to display the current moderator when no such element existed in the DOM to populate with the data. This occurred right after a temp mod's powers were transferred away. Now we check if the client is a temp mod when processing the "kill player" event and, if so, do not attempt to update the content of that element (it will get updated when the client's view is synced as a part of the mod transfer event).