@graphty/graphty-element / session / JournalApi
Interface: JournalApi ​
Defined in: graphty-element/src/session/journal.ts:54
The record of the commands a session ran: session.journal.
Properties ​
cap ​
cap:
number
Defined in: graphty-element/src/session/journal.ts:77
How many entries are kept; when one more is appended the oldest is dropped. 1000 by default. Setting it lower drops the oldest at once.
Throws ​
A GraphtyError coded E_OPTION_RANGE for anything but a positive integer.
entries ​
readonlyentries: readonlyJournalEntry[]
Defined in: graphty-element/src/session/journal.ts:56
Every entry kept, oldest first. A new array after each change.
Methods ​
clear() ​
clear():
void
Defined in: graphty-element/src/session/journal.ts:71
Forget every entry. Changes nothing else.
Returns ​
void
get() ​
get(
id):JournalEntry|undefined
Defined in: graphty-element/src/session/journal.ts:63
One entry.
Parameters ​
id ​
string
Its id, such as a run's journalId.
Returns ​
JournalEntry | undefined
The entry, or undefined when it was never written, was dropped, or was replaced by a later command of the same gesture.
subscribe() ​
subscribe(
fn): () =>void
Defined in: graphty-element/src/session/journal.ts:69
Hear every entry as it is appended. The same entries journal:appended publishes.
Parameters ​
fn ​
(entry) => void
Called with each new entry.
Returns ​
A function that stops the subscription.
() => void