@mathjax/src
    Preparing search index...

    Interface Factory<N, C>

    The Factory interface

    Factory<N, C> takes a node type N and a node class C, which give the interfaces for the node instance and the node constructors. We need both for two reasons: first, you can't use typeof N to get C, since N is a type not an object, and if N has static members, we may want to access them from the results of getNodeClass(kind) (this is done in MmlNodes, for example).

    interface Factory<N extends FactoryNode, C extends FactoryNodeClass<N>> {
        create(kind: string): N;
        deleteNodeClass(kind: string): void;
        getKinds(): string[];
        getNodeClass(kind: string): C;
        nodeIsKind(node: N, kind: string): boolean;
        setNodeClass(kind: string, nodeClass: C): void;
    }

    Type Parameters

    • N extends FactoryNode

      The node type created by the factory

    • C extends FactoryNodeClass<N>

      The class of the node being constructed (for access to static properties)

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Parameters

      • kind: string

        The kind of node to create

      Returns N

      The newly created node of the given kind

    • Parameters

      • kind: string

        The kind whose definition is to be deleted

      Returns void

    • Parameters

      • kind: string

        The kind of node whose class is to be returned

      Returns C

      The class object for the given kind

    • Parameters

      • node: N

        The node to test if it is of a given kind

      • kind: string

        The kind to test for

      Returns boolean

      True if the node is of the given kind, false otherwise

    • Defines a class for a given node kind

      Parameters

      • kind: string

        The kind whose class is being defined

      • nodeClass: C

        The class for the given kind

      Returns void