Compare commits

..

No commits in common. "aba98174900412ba7548abab147ef7713b60acc5" and "b12eb25d7891117b44c95f49f6b380d832787069" have entirely different histories.

View file

@ -1,27 +0,0 @@
type ChatMessage = {
name: string;
message: any;
timestamp: number;
};
let chatHistory: ChatMessage[] = [];
function addMessage(name: string, message: any): void {
const newMessage: ChatMessage = {
name: name,
message: message,
timestamp: Date.now()
};
chatHistory.push(newMessage);
console.log(`Added message from ${name}: ${message}`);
}
function removeMessage(timestamp: number): void {
const index = chatHistory.findIndex((msg) => msg.timestamp === timestamp);
if (index > -1) {
chatHistory.splice(index, 1);
console.log(`Removed message with timestamp: ${timestamp}`);
} else {
console.log(`Message not found with timestamp: ${timestamp}`);
}
}