Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IClassCompVN

The IClassCompVN interface represents a virtual node for a JSX-based component.

Hierarchy

Index

Properties

Readonly comp

Gets the component instance.

Optional Readonly creator

creator: IComponent

Component that created this node in its render method (or undefined).

Optional Readonly depth

depth: number

Level of nesting at which the node resides relative to the root node.

Optional Readonly index

index: number

Zero-based index of this node in the parent's list of sub-nodes. This is zero for the root nodes that don't have parents.

Optional Readonly name

name: string

Gets node's display name. This is used mostly for tracing and error reporting. The name can change during the lifetime of the virtual node; for example, it can reflect an "id" property of an element.

Optional Readonly parent

parent: IVNode

Gets node's parent. This is undefined for the top-level (root) nodes.

Optional Readonly subNodes

subNodes: IVNode[]

List of sub-nodes.

Methods

getService

  • getService<K>(id: K, defaultService?: IServiceDefinitions[K], useSelf?: boolean): IServiceDefinitions[K]
  • Retrieves the value for a service with the given ID registered by a closest ancestor component or the default value if none of the ancestor components registered a service with this ID. This method doesn't establish a subscription and only reflects the current state.

    Type parameters

    Parameters

    • id: K
    • Optional defaultService: IServiceDefinitions[K]
    • Optional useSelf: boolean

    Returns IServiceDefinitions[K]

publishService

  • publishService<K>(id: K, service: IServiceDefinitions[K]): void
  • Registers an object of any type as a service with the given ID that will be available for consumption by descendant components.

    Type parameters

    Parameters

    • id: K
    • service: IServiceDefinitions[K]

    Returns void

requestUpdate

  • requestUpdate(): void
  • This method is called by the component when it needs to be updated.

    Returns void

subscribeService

  • subscribeService<K>(id: K, ref: RefPropType<IServiceDefinitions[K]>, defaultService?: IServiceDefinitions[K], useSelf?: boolean): void
  • Subscribes to a service with the given ID. If the service with the given ID is registered by this or one of the ancestor components, the passed Ref object will reference it; otherwise, the Ref object will be set to the defaultValue (if specified) or will remain undefined. Whenever the value of the service that is registered by this or a closest ancestor component is changed,the Ref object will receive the new value. The useSelf optional parameter determines whether the component can subscribe to the service published by itself. The default is false.

    Type parameters

    Parameters

    • id: K
    • ref: RefPropType<IServiceDefinitions[K]>
    • Optional defaultService: IServiceDefinitions[K]
    • Optional useSelf: boolean

    Returns void

unpublishService

  • unpublishService<K>(id: K): void

unsubscribeService

  • unsubscribeService<K>(id: K): void
  • Unsubscribes from a service with the given ID. The Ref object that was used to subscribe will be set to undefined.

    Type parameters

    Parameters

    • id: K

    Returns void

Generated using TypeDoc