This class is a wrapper container for a PConnect object.

When constructed will store a copy of the fully resolved component props (see getComponentProps). The container holds a reference to all instantiated children.

A few life cycle hooks are initiated

  • initContainer is called immediately after construction
  • updateContainer is called anytime the state associated with the pconnect is changed
  • destroyContainer is called on all children whenever

Type Parameters

  • T = any

Hierarchy (view full)

Constructors

  • The constructor for PContainer.

    Type Parameters

    • T = any

    Parameters

    • pconnect: PConnect

      The PConnect object which is the configuration for this container

    • id: string

      The ID of the container, used as a key to retrieve the container later.

    Returns SimpleTable<T>

Properties

cells: PContainer<any>[][] = []
componentName: string

The name of this container as retrieved by container.getComponentName()

config: any

The configuration of this container.

id: string

The ID of the container, used as a key to retrieve the container later.

pconnect: PConnect

The PConnect object which is the configuration for this container

unsubscribe: (() => void)

A method to unsubscribe this container from listening to state changes

updates: EventObserver = ...

A stream of state update events.

In general updates are managed by the DX Engine. However, in some cases you may need to react to state changes in the component directly. In this scenario a consumer can call container.updates.subscribe(fn), where the fn will be called when the state of the container changes. Use container.config to retrieve the latest state of the container.

counter: number = 0

Accessors

  • get children(): PContainer<any>[]
  • Get the children of this container. This list of children is managed by the DX Engine, where each child itself is the correct PContainer instance for a PConnect object coming from the Constellation Core.

    Returns PContainer<any>[]

  • set children(children): void
  • Fully replace the children of this container.

    To allow for cleanupm, the onDestroy method of the existing children are called before they are replaced.

    Parameters

    Returns void

Methods

  • Create a new child PContainer of the given type, with the given label.

    The child will be created with the same context and container name as the current PContainer. The label will be used to construct a new property name, and the value will be set to @P .<label>.

    Parameters

    • type: string

      The type of the child to be created.

    • label: string

      The label of the child to be created.

    Returns Promise<PContainer<any>>

    The newly created PContainer.

  • Initializes the container by setting up its configuration and component name, and generating a unique identifier. It subscribes to the store for state changes to determine when updates are necessary.

    Returns void

  • Clean up all resources when the container is destroyed. This is called when the container is no longer referenced by the core.

    Returns void

  • Abstract initialization method to be implemented by instances of container types. onInit is called after default initialization of the PContainer is completed

    Returns Promise<void>

  • Abstract update method to be implemented by instances of container types. onUpdate is called everytime the state association with this container instance is updated by the Constellation Core.

    Returns Promise<void>