Crate ywasm

source ·

Structs

  • A collection used to store data in an indexed sequence structure. This type is internally implemented as a double linked list, which may squash values inserted directly one after another into single list node upon transaction commit.
  • Event generated by YArray.observe method. Emitted during transaction commit phase.
  • A ywasm document type. Documents are most important units of collaborative resources management. All shared collections live within a scope of their corresponding documents. All updates are generated on per document basis (rather than individual shared type). All operations on shared collections happen via YTransaction, which lifetime is also bound to a document.
  • Collection used to store key-value entries in an unordered manner. Keys are always represented as UTF-8 strings. Values can be any value type supported by Yrs: JSON-like primitives as well as shared data types.
  • Event generated by YMap.observe method. Emitted during transaction commit phase.
  • A shared data type used for collaborative text editing. It enables multiple users to add and remove chunks of text in efficient manner. This type is internally represented as a mutable double-linked list of text chunks - an optimization occurs during YTransaction.commit, which allows to squash multiple consecutively inserted characters together as a single chunk of text even between transaction boundaries in order to preserve more efficient memory model.
  • Event generated by YYText.observe method. Emitted during transaction commit phase.
  • A transaction that serves as a proxy to document block store. Ywasm shared data types execute their operations in a context of a given transaction. Each document can have only one active transaction at the time - subsequent attempts will cause exception to be thrown.
  • Event generated by YXmlElement.observe method. Emitted during transaction commit phase.
  • XML element data type. It represents an XML node, which can contain key-value attributes (interpreted as strings) as well as other nested XML elements or rich text (represented by YXmlText type).
  • Event generated by YXmlElement.observe method. Emitted during transaction commit phase.
  • Represents a list of YXmlElement and YXmlText types. A YXmlFragment is similar to a YXmlElement, but it does not have a nodeName and it does not have attributes. Though it can be bound to a DOM element - in this case the attributes and the nodeName are not shared
  • A shared data type used for collaborative text editing, that can be used in a context of YXmlElement nodee. It enables multiple users to add and remove chunks of text in efficient manner. This type is internally represented as a mutable double-linked list of text chunks
  • Event generated by YXmlText.observe method. Emitted during transaction commit phase.

Functions

  • Applies delta update generated by the remote document replica to a current document. This method assumes that a payload maintains lib0 v1 encoding format.
  • Applies delta update generated by the remote document replica to a current document. This method assumes that a payload maintains lib0 v2 encoding format.
  • Converts a sticky index (see: createStickyIndexFromType) into an object containing human-readable index.
  • Retrieves a sticky index corresponding to a given human-readable index pointing into the shared ytype. Unlike standard indexes sticky indexes enables to track the location inside of a shared y-types, even in the face of concurrent updates.
  • Returns a string dump representation of a given update encoded using lib0 v1 encoding.
  • Returns a string dump representation of a given update encoded using lib0 v2 encoding.
  • Deserializes sticky index serialized previously by encodeStickyIndex.
  • Encodes all updates that have happened since a given version vector into a compact delta representation using lib0 v1 encoding. If vector parameter has not been provided, generated delta payload will contain all changes of a current ywasm document, working effectivelly as its state snapshot.
  • Encodes all updates that have happened since a given version vector into a compact delta representation using lib0 v2 encoding. If vector parameter has not been provided, generated delta payload will contain all changes of a current ywasm document, working effectivelly as its state snapshot.
  • Encodes a state vector of a given ywasm document into its binary representation using lib0 v1 encoding. State vector is a compact representation of updates performed on a given document and can be used by encode_state_as_update on remote peer to generate a delta update payload to synchronize changes between peers.
  • Serializes sticky index created by createStickyIndexFromType into a binary payload.
  • When called will call console log errors whenever internal panic is called from within WebAssembly module.