Function bindYjsToNode

Creates a node that is bound to a Y.js data structure. Y.js Map and Array instances are bound to MobX objects and arrays, respectively.

  • Type Parameters

    • T extends object

    Parameters

    • __namedParameters: { yjsDoc: Doc; yjsObject: YjsStructure; yjsOrigin?: symbol }
      • yjsDoc: Doc

        The Y.js document.

      • yjsObject: YjsStructure

        The Y.js data structure to bind.

      • OptionalyjsOrigin?: symbol

        The Y.js origin symbol used for binding transactions. One will be automatically generated if not provided.

    Returns {
        dispose: Dispose;
        getYjsObjectForNode: (node: object) => YjsStructure;
        node: T;
        "[dispose]"(): void;
    }

    • dispose: Dispose

      Disposes the binding.

    • getYjsObjectForNode: (node: object) => YjsStructure

      Resolves the corresponding YjsStructure for a given target node.

      Error if the target node is not found in the bound tree.

    • node: T

      The bound node.

    • [dispose]:function
      • Disposes the binding.

        Returns void