Skip to content

Packages  ›  trotsky  ›  StepTap

StepTap class

Represents a step that allows interception of the current Step instance for custom processing or side effects.

Signature:

typescript
export declare class StepTap<P = StepBuilder, C = unknown, O = null> extends Step<P, C, O>

Extends: Step<P, C, O>

Remarks

The StepTap class enables the execution of a provided interceptor function, which receives the current step as its argument. This is useful for debugging, logging, or performing side effects without altering the main flow.

Constructors

Constructor

Modifiers

Description

(constructor)(agent, parent, interceptor)

Creates an instance of StepTap.

Properties

Property

Modifiers

Type

Description

_interceptor

protected

StepTapInterceptor

The interceptor function to be executed during the apply phase. It receives the current Step instance and can perform custom operations.

Methods

Method

Modifiers

Description

apply()

Executes the interceptor function with the current step as its argument.

clone(rest)

Clones the current step and returns a new instance with the same parameters.