json-joy
    Preparing search index...

    Class ObjApi<N>

    Local changes API for the obj JSON CRDT node ObjNode.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    api: ModelApi<any>
    node: N

    Accessors

    • get events(): NodeEvents<N>

      Event target for listening to node changes. You can subscribe to "view" events, which are triggered every time the node's view changes.

      node.events.on('view', () => {
      // do something...
      });

      Returns NodeEvents<N>

    • get s(): ProxyNodeObj<N>

      Returns a proxy object for this node. Allows to access object properties by key.

      Returns ProxyNodeObj<N>

    Methods

    • Returns the API object of the extension if the node is an extension node. When the ext parameter is provided, it checks if the node is an instance of the given extension and returns the object's TypeScript type. Otherwise, it returns the API object of the extension, but without any type checking.

      Returns undefined | ExtApi<any> | JsonNodeApi<VecNodeExtensionData<N>>

      API of the extension

    • Returns the API object of the extension if the node is an extension node. When the ext parameter is provided, it checks if the node is an instance of the given extension and returns the object's TypeScript type. Otherwise, it returns the API object of the extension, but without any type checking.

      Type Parameters

      • EN extends ExtNode<any, any>
      • EApi extends ExtApi<EN>

      Parameters

      • ext: Extension<any, any, EN, EApi, any, any>

        Extension of the node

      Returns EApi

      API of the extension

    • Deletes a list of keys from the object.

      Parameters

      • keys: string[]

        List of keys to delete.

      Returns void

      Reference to itself.

    • Get API instance of a child node.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • key: K

        Object key to get.

      Returns JsonNodeApi<UnObjNode<N>[K]>

      A specified child node API.

    • Checks if a key exists in the object.

      Parameters

      • key: string

        Key to check.

      Returns boolean

      True if the key exists, false otherwise.

    • Find a child node at the given path starting from this node and wrap it in a local changes API.

      Parameters

      • Optionalpath: ApiPath

        Path to the child node to find.

      Returns ValApi<ValNode<any>>

      Local changes API for the child node at the given path.