StepTap class
Represents a step that allows interception of the current Step instance for custom processing or side effects.
Signature:
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.
Example 1
Log actor information:
await Trotsky.init(agent)
.actor("bsky.app")
.tap((step) => {
console.log(`Handle: ${step.context.handle}`)
console.log(`Followers: ${step.context.followersCount}`)
})
.run()Example 2
Debug post processing:
await Trotsky.init(agent)
.searchPosts({ q: "typescript" })
.take(10)
.each()
.tap((step) => {
console.log(`Processing post: ${step.context.uri}`)
console.log(`Likes: ${step.context.likeCount}`)
})
.like()
.run()Constructors
Constructor | Modifiers | Description |
|---|---|---|
Creates an instance of |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
| 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 |
|---|---|---|
Executes the interceptor function with the current step as its argument. | ||
Clones the current step and returns a new instance with the same parameters. |