Skip to content

DependableTrait

Trait for IDependable.

Traits are interfaces that are privately implemented by objects. Instead of showing up in the public interface of a class, they need to be queried explicitly. This is used to implement certain framework features that are not intended to be used by Construct consumers, and so should be hidden from accidental use.

Example

// Usage
const roots = DependableTrait.get(construct).dependencyRoots;
// Definition
DependableTrait.implement(construct, {
  get dependencyRoots() { return []; }
});

Initializers

import { DependableTrait } from '@alicloud/ros-cdk-core'
new DependableTrait()
Name Type Description

Static Functions

Name Description
get Return the matching DependableTrait for the given class instance.
implement Register instance to have the given DependableTrait.

get

import { DependableTrait } from '@alicloud/ros-cdk-core'
DependableTrait.get(instance: IDependable)

Return the matching DependableTrait for the given class instance.

instanceRequired


implement

import { DependableTrait } from '@alicloud/ros-cdk-core'
DependableTrait.implement(instance: IDependable, trait: DependableTrait)

Register instance to have the given DependableTrait.

Should be called in the class constructor.

instanceRequired


traitRequired


Properties

Name Type Description
dependencyRoots IConstruct[] The set of constructs that form the root of this dependable.

dependencyRootsRequired

public readonly dependencyRoots: IConstruct[];

The set of constructs that form the root of this dependable.

All resources under all returned constructs are included in the ordering dependency.