useEventLog
functionsignature
useEventLog(storeId, options?): { clear: () => void; entries: EventLogEntry[] }Maintains a chronological event log for a given store.
Parameters
| Name | Type | Description |
|---|---|---|
storeId | null | string | The store ID whose events to return, or null to get an
empty slice (collection still runs for all stores). |
| Name | Type | Description |
|---|---|---|
options? | UseEventLogOptions | Optional configuration (see UseEventLogOptions). |
Returns
{ clear: () => void; entries: EventLogEntry[] }, An object containing the entries array and a clear function.
Example
example
import { useEventLog } from "@yoltra/devtools-ui";
function EventTimeline({ storeId }: { storeId: string }) {
const { entries, clear } = useEventLog(storeId, { maxEntries: 500 });
return (
<div>
<button onClick={clear}>Clear</button>
<ul>
{entries.map((e, i) => (
<li key={i}>{e.event.type} @ {e.timestamp}</li>
))}
</ul>
</div>
);
}