Automerge Repo - v2.3.0-alpha.0
    Preparing search index...
    • Update the contents of an automerge document

      Type Parameters

      • T

        The type of the value contained in the document

      Parameters

      Returns Automerge.Doc<T>

      let doc1 = automerge.init()
      doc1 = automerge.change(doc1, d => {
      d.key = "value"
      })
      assert.equal(doc1.key, "value")
      doc1 = automerge.change(doc1, "add another value", d => {
      d.key2 = "value2"
      })
      doc1 = automerge.change(doc1, {message: "add another value", time: 1640995200}, d => {
      d.key2 = "value2"
      })
      let patchedPath
      let patchCallback = patch => {
      patchedPath = patch.path
      }
      doc1 = automerge.change(doc1, {message: "add another value", time: 1640995200, patchCallback}, d => {
      d.key2 = "value2"
      })
      assert.equal(patchedPath, ["key2"])