Spaces:
Running
Running
File size: 406 Bytes
33ca623 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import { createPubSub } from "create-pubsub";
type LogEntry = {
timestamp: string;
message: string;
};
export const logEntriesPubSub = createPubSub<LogEntry[]>([]);
const [updateLogEntries, , getLogEntries] = logEntriesPubSub;
export function addLogEntry(message: string) {
updateLogEntries([
...getLogEntries(),
{
timestamp: new Date().toISOString(),
message,
},
]);
}
|