Created
June 22, 2016 03:02
-
-
Save unitycoder/3cd1d53ee7be136a2d0afda1919d4e91 to your computer and use it in GitHub Desktop.
Javascript Struct History Buffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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