* Cleanups the UI and removes all Firebase listeners.
()
| 517 | * Cleanups the UI and removes all Firebase listeners. |
| 518 | */ |
| 519 | function cleanupUi() { |
| 520 | // Remove all previously displayed posts. |
| 521 | topUserPostsSection.getElementsByClassName('posts-container')[0].innerHTML = |
| 522 | ''; |
| 523 | recentPostsSection.getElementsByClassName('posts-container')[0].innerHTML = |
| 524 | ''; |
| 525 | userPostsSection.getElementsByClassName('posts-container')[0].innerHTML = ''; |
| 526 | |
| 527 | // Stop all currently listening Firebase listeners. |
| 528 | listeningFirebaseRefs.forEach(function (ref) { |
| 529 | off(ref); |
| 530 | }); |
| 531 | listeningFirebaseRefs = []; |
| 532 | } |
| 533 | |
| 534 | /** |
| 535 | * The ID of the currently signed-in User. We keep track of this to detect Auth state change events that are just |