Skip to content

Virtual DOM Adapter

HydratorVirtualDomAdapter

Bases: VDomLookupTable

hyderator adapter for all virtual dom operations methods should start with: hyd_vdom_

Source code in zenaura/client/hydrator/virtual_dom_adapter.py
class HydratorVirtualDomAdapter(
    VDomLookupTable
):
    """
        hyderator adapter for all virtual dom operations
        methods should start with:
        hyd_vdom_
    """

    def hyd_vdom_update(self, comp: Component) -> None:
        """
            virtual dom operation : updates virtual dom of component
            args:
                comp: Component
        """
        self.zen_dom_table[comp.id] = comp.render()

    def hyd_vdom_delete(self, comp: Component) -> None:
        """
            virtual dom operation : deletes virtual dom of component
            args:
                comp: Component
        """
        del self.zen_dom_table[comp.id]

    def hyd_vdom_update_with_new_render(self, comp: Component, new_node):
        """
            update component with new node
            args:
                comp: Component
                new_node: Node
        """
        self.zen_dom_table[comp.id] = new_node

hyd_vdom_delete(comp)

virtual dom operation : deletes virtual dom of component args: comp: Component

Source code in zenaura/client/hydrator/virtual_dom_adapter.py
def hyd_vdom_delete(self, comp: Component) -> None:
    """
        virtual dom operation : deletes virtual dom of component
        args:
            comp: Component
    """
    del self.zen_dom_table[comp.id]

hyd_vdom_update(comp)

virtual dom operation : updates virtual dom of component args: comp: Component

Source code in zenaura/client/hydrator/virtual_dom_adapter.py
def hyd_vdom_update(self, comp: Component) -> None:
    """
        virtual dom operation : updates virtual dom of component
        args:
            comp: Component
    """
    self.zen_dom_table[comp.id] = comp.render()

hyd_vdom_update_with_new_render(comp, new_node)

update component with new node args: comp: Component new_node: Node

Source code in zenaura/client/hydrator/virtual_dom_adapter.py
def hyd_vdom_update_with_new_render(self, comp: Component, new_node):
    """
        update component with new node
        args:
            comp: Component
            new_node: Node
    """
    self.zen_dom_table[comp.id] = new_node