method BehaviorLike.handle
BehaviorLike.handle(
work: TWork,
next: () => Promise<TResult>
): TResult | Promise<TResult>

Wraps the rest of the chain.

Parameters

work: TWork

The work item being handled

next: () => Promise<TResult>

Invokes the next behaviour in declared order, ending at the terminal handler

Return Type

TResult | Promise<TResult>

The chain result. Returning WITHOUT calling next short-circuits the chain: downstream behaviours and the terminal are skipped and this value becomes the result.

Usage

import { type BehaviorLike } from "common/src/index.ts";