zibri
    Preparing search index...

    Class PreactCollector

    Walks a Preact VNode tree, collects event handlers, stamps data-ssr-handlers attributes, and produces a reattachment script section for client-side bootstrap.

    Index

    Constructors

    Methods

    • Applies a rename map to all handler sources (word-boundary replacement). Called by PreactUtilities once per nested component, in walk order, so that names declared in outer components are correctly renamed before inner components' prop binding values reference them.

      Parameters

      • renameMap: Map<string, string>

        E.g. Map { 'clickAndLog' => 'testButton0_clickAndLog' }.

      • componentPrefix: string

        Prefix of the component.

      • ancestorMap: Map<string, string | undefined>

        Map of any ancestor components.

      Returns void

    • Gets the section in the script responsible for reattaching any handlers of this prefix.

      Parameters

      • ownerPrefix: string | undefined

        The component prefix.

      Returns string

      The js section as a string.

    • Walks the given virtual dom node recursively and collects any handlers found.

      Parameters

      • node: VNode<{ [key: string]: string | undefined }>

        The node to walk.

      • parentPrefix: string | undefined

        The prefix of the immediately enclosing custom component, if any.

      Returns void

      When there was an incorrect component setup.