auth.andert.me/src/lib/services/messages.js

12 lines
310 B
JavaScript
Raw Normal View History

// 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([]);
}