1
2
3
4
5
6
7
8
9
10
import { chatMessages } from "https://esm.town/v/darrinm/chatMessages";
export let sendChatMessage = (message: string, sender: string) => {
chatMessages.unshift({ message, sender });
if (chatMessages.length > 20) {
chatMessages.pop();
}
return chatMessages.map((a) => a);
};
// Forked from @nimalu.sendChatMessage
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023