ui/client/features/notes/domain/NoteDraft
Pure (DOMAIN-001): what "unsaved" means, what a list row looks like for a note, and which notes are read-only.
Cockpit client (features), next. Source: ui/client/features/notes/domain/NoteDraft.ts.
Variables#
AUTOSAVE_MS#
constAUTOSAVE_MS:800=800
Defined in: ui/client/features/notes/domain/NoteDraft.ts:5
Autosave fires this long after the last keystroke (design: docs/design/ia-five-screens.md section 5).
Functions#
byRecent()#
byRecent(
rows):NoteRow[]
Defined in: ui/client/features/notes/domain/NoteDraft.ts:38
Newest-updated first, the order the server lists them in.
Parameters#
rows
NoteRow[]
Returns#
NoteRow[]
draftOf()#
draftOf(
note):Draft
Defined in: ui/client/features/notes/domain/NoteDraft.ts:9
Parameters#
note
Returns#
isDirty()#
isDirty(
note,draft):boolean
Defined in: ui/client/features/notes/domain/NoteDraft.ts:14
Unsaved: the page holds text the server copy does not.
Parameters#
note
Note | null
draft
Returns#
boolean
isReadOnly()#
isReadOnly(
note):boolean
Defined in: ui/client/features/notes/domain/NoteDraft.ts:17
A note that already ran is history: it is read, duplicated, deleted, never edited.
Parameters#
note
Note | null
Returns#
boolean
pickInitial()#
pickInitial(
rows,wanted):string|null
Defined in: ui/client/features/notes/domain/NoteDraft.ts:41
The note to open when the screen loads: the one named in the address if it exists, else the most recent.
Parameters#
rows
NoteRow[]
wanted
string | null
Returns#
string | null
rowOf()#
rowOf(
note):NoteRow
Defined in: ui/client/features/notes/domain/NoteDraft.ts:20
The list row for a note, built the way the server builds it, so the list can follow a save without a refetch.
Parameters#
note
Returns#
sameDraft()#
sameDraft(
a,b):boolean
Defined in: ui/client/features/notes/domain/NoteDraft.ts:11
Parameters#
a
b
Returns#
boolean