Skip to content
v2.273.0

AspectOptions Struct ​

Options when Applying an Aspect.

Example ​

ts
class MutatingAspect implements IAspect {
  visit(node: IConstruct) {
    // Modifies a resource in some way
  }
}

class ValidationAspect implements IAspect {
  visit(node: IConstruct) {
    // Perform some readonly validation on the cosntruct tree
  }
}

const stack = new Stack();

Aspects.of(stack).add(new MutatingAspect(), { priority: AspectPriority.MUTATING } );  // Run first (mutating aspects)
Aspects.of(stack).add(new ValidationAspect(), { priority: AspectPriority.READONLY } );  // Run later (readonly aspects)

Properties ​

prioritynumberpriorityint | floatpriorityNumberPrioritydoublePriority*float64= AspectPriority.DEFAULT#
The priority value to apply on an Aspect. Priority must be a non-negative integer.

Aspects that have same priority value are not guaranteed to be executed in a consistent order.