12 lines
310 B
JavaScript
12 lines
310 B
JavaScript
|
// src/lib/messaging.js
|
||
|
import { messagesStore } from '$lib/data//stores';
|
||
|
|
||
|
export function addMessage(message) {
|
||
|
const timestamp = new Date().toLocaleString();
|
||
|
messagesStore.update((messages) => [{ text: message, timestamp }, ...messages]);
|
||
|
}
|
||
|
|
||
|
export function clearMessages() {
|
||
|
messagesStore.set([]);
|
||
|
}
|