-
Notifications
You must be signed in to change notification settings - Fork 0
Versioning, clone and copy
MyWebstrates uses the CRDT-based framework Automerge as its data layer. This means that the edit history of a webstrate is retained.
To see the version hash of the current version of a webstrate:
webstrate.versionHash
To see the local version number of the webstrate. Note that the number might differ from other clients:
webstrate.version
To restore a previous version:
webstrate.restore(number|versionHash|tag)
Restoring a previous version is non-destructive. It will compute the set of changes needed to get to the same state as the previous version and apply those changes. This way, you will see the version number increment when performing a restore.
Give the current version of a webstrate a human-readable name:
webstrate.tag(tagName)
To see the list of tags:
webstrate.tags
MyWebstrates distinguishes between copying and cloning a webstrate. A copy does not retain history while a clone does. Changes done to a clone can be merged back into the source webstrate.
To copy a webstrate:
webstrate.copy([options])
Copy takes optional parameters, whether the copy should be local meaning that federated sync servers are removed (default false), an optional version hash that the copy should be based on, and whether the new webstrate should be opened in a new tab. An example of options could be {local: true, openInNewTab: false}
or {local: false, version: "1ca636fb1c94ab7ef740054eca043d7624f4fef33b4cd8147a4c49b15eab75ab"}
.
Per default, local
is false
and openInNewTab
is true
. version
can be a number, version hash, or tag.
To clone a webstrate:
webstrate.clone([options])
Clone can take the optional parameter openInNewTab
that is true
by default.
To merge changes from a clone (say with ID 3FKdw63263aUrNEjYFE7uckqfWqg
) call the following from within the webstrate you want to pull the changes to:
webstrate.merge("3FKdw63263aUrNEjYFE7uckqfWqg");