Skip to main content
Module

x/automerge/stable.ts>merge

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
Go to Latest
function merge
import { merge } from "https://deno.land/x/automerge@2.2.0/stable.ts";

Merge remote into local

Parameters

local: Doc<T>
  • The document to merge changes into
remote: Doc<T>
  • The document to merge changes from

Returns

  • The merged document

Often when you are merging documents you will also need to clone them. Both arguments to merge are frozen after the call so you can no longer call mutating methods (such as change) on them. The symtom of this will be an error which says "Attempting to change an out of date document". To overcome this call clone on the argument before passing it to merge.