Silver Challenge: Caching Messages

If you are in the middle of a chat and need to reload the browser, all of your messages disappear. It is nice that your UserStore remembers your username – but it would be better if you also had a similar mechanism for caching chat messages.

Create a MessageStore that subclasses Store. It should store messages as they come in, making sure not to store the same message more than once.

When the page loads, Chattrbox should get any cached messages from MessageStore. Decide if you would like messages to persist even if the browser tab is closed and re-opened. (If so, what alternative to sessionStorage would you use?)

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.