MiniSearch / client /modules /logEntries.ts
github-actions[bot]
Sync from https://github.com/felladrin/MiniSearch
8163715
raw
history blame contribute delete
406 Bytes
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,
},
]);
}