Docs · Events

Listening in

What fires on document as a page boots, saves, goes dirty and receives live sync.

Event (on document)Fires whendetail
clay:readyclayjs finished booting (same moment clay.ready resolves){clay}
clay:save-savinga save has been in flight for 500ms (fast saves skip straight to the result){msg, timestamp}
clay:save-savedthe server confirmed the write{msg, timestamp}
clay:save-errorthe server answered with a problem{msg, timestamp}
clay:save-offlinethe browser is offline (clayjs re-saves when the connection returns){msg, timestamp}
clay:dirtythe page holds work no save has written. It follows DOM mutations and user input; a script setting a [persist] control's value programmatically is not observed. One event per state change, so a burst of keystrokes is one clay:dirty, and it fires before autosave does—
clay:cleana save (or a verified merge) has accounted for everything the gate saw—
clay:snapshot-readya snapshot has been cloned, before any stripping. Read detail.documentElement; do not change it. It is also where both change-detection baselines come from, and the change checks do not fire this event, so an edit made here is saved but never compared and the page reads dirty forever. Use clay.addDocumentTransform(fn) to change what gets saved.{documentElement}
clay:sync-applieda live-sync update landed (sync plugin){seq, source, by, report, unresolved}; source is peer (another open copy) or disk (the file changed underneath you)
clay:sorteda drag-drop reorder landed (sortable plugin); fires on the container and bubbles{item, from, to, oldIndex, newIndex}
clay:view-save-attempta visitor clicked a [trigger-save] element in view mode; show your own notice—