IReferenceable

Interface with methods to set refernces for components that depend on other components.

Description

The IReferenceable interface allows you to set references for components that depend on other components.

Important points

  • If component requires explicit notification to unset references, it must also implement the IUnreferenceable interface.

Instance methods

setReferences

Sets references to dependent components.

setReferences(references: IReferences): void

  • references: IReferences - references to locate the component dependencies.

Examples

export class MyController implements IReferenceable {
    public _persistence: IMyPersistence;
    ...    
    public setReferences(references: IReferences): void {
        this._persistence = references.getOneRequired<IMyPersistence>(
            new Descriptor("mygroup", "persistence", "*", "*", "1.0")
        );
    }
    ...
}

See also