Skip to content

Returns the most recent change created by this document's actor. Useful for tracking local changes or implementing undo/redo functionality.

Usage

am_get_last_local_change(doc)

Arguments

doc

An Automerge document

Value

An am_change object, or NULL if no local changes have been made.

Examples

doc <- am_create()

# Initially, no local changes
am_get_last_local_change(doc)  # NULL
#> NULL

# Make a change
doc$key <- "value"
am_commit(doc, "Add key")

# Now we have a local change
change <- am_get_last_local_change(doc)
change
#> <Automerge Change>
#> Hash: 88 01 63 86 ...
#> Message: Add key 
am_change_message(change)  # "Add key"
#> [1] "Add key"

am_close(doc)