Appearance
Function: step()
ts
function step<Args, ReturnType>(fn: (...args: Args) => ReturnType, args: Args): Promise<ReturnType>;Defined in: src/hot-reload/core/step.ts:80
Run a function as a replayable step with hot-reload support. Skip execution and return the saved result when the function has not changed.
Type Parameters
| Type Parameter |
|---|
Args extends unknown[] |
ReturnType |
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | (...args: Args) => ReturnType | The function to run. |
args | Args | The arguments to pass to the function. |
Returns
Promise<ReturnType>
The result of the function execution.
Example
ts
const greeting = await step(welcomeMessage, [ctx, 'Hello']);
await step(processOrder, [ctx, greeting]);