Implement the Chat Handler Class
Explore how to implement a ChatHandler class in JavaScript to manage a chat list using doubly linked lists and LRU cache concepts. Learn to create message nodes with user details, generate current time stamps, and handle message updates, building a foundational project for web-based chat applications.
Introduction
From this lesson onwards, we are going to start implementing the project. We'll be following the steps mentioned below:
Create a class to construct our chat list data structure.
Implement a function to get the current time and attach it to every new message.
Write a function to create a node to store the user's name, image, and message.
Write a function to get a node from the linked list using the hashmap and the user's id.
Write a utility function to handle the scenario where a new message is generated.
Write a utility function to handle the scenario where a message is deleted.
Before starting the implementation, let's first make sure we understand how ...