Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Created June 22, 2016 03:02
Show Gist options
  • Select an option

  • Save unitycoder/3cd1d53ee7be136a2d0afda1919d4e91 to your computer and use it in GitHub Desktop.

Select an option

Save unitycoder/3cd1d53ee7be136a2d0afda1919d4e91 to your computer and use it in GitHub Desktop.
Javascript Struct History Buffer
// we want to keep history of all sent messages
var obj = {
time: (new Date()).getTime(),
text: htmlEntities(message.utf8Data),
author: userName,
color: userColor
};
history.push(obj);
history = history.slice(-100); // keep max 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment