# OperationContext

Source: /tuil/docs/reference/packages/operations/api/operation-context
Locale: en

interface exported by @mwillbanks/tuil-operations.



{/* Generated by tooling/docs/generate-reference.ts. */}

## interface [#interface]

Public interface exported by `@mwillbanks/tuil-operations`.

```ts
export interface OperationContext {
  readonly signal: AbortSignal;
  readonly attempt: number;
  readonly updateProgress: (progress: OperationProgress) => void;
  readonly log: (line: string) => void;
  readonly runChild: <T>(definition: OperationDefinition<T>) => Promise<T>;
  readonly block: (message: string) => never;
  readonly waitFor: <T>(work: Promise<T>) => Promise<T>;
}
```

## Members [#members]

| Member           | Type                                                    | Required | Description                                                                                      | Related types                                                                         |
| ---------------- | ------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| `signal`         | `AbortSignal`                                           | Yes      | The `signal` member uses the `AbortSignal` contract.                                             | —                                                                                     |
| `attempt`        | `number`                                                | Yes      | The `attempt` member uses the `number` contract.                                                 | —                                                                                     |
| `updateProgress` | `(progress: OperationProgress) => void`                 | Yes      | The `updateProgress` member uses the `(progress: OperationProgress) => void` contract.           | [`OperationProgress`](/tuil/docs/reference/packages/operations/api/operation-progress)     |
| `log`            | `(line: string) => void`                                | Yes      | The `log` member uses the `(line: string) => void` contract.                                     | —                                                                                     |
| `runChild`       | `<T>(definition: OperationDefinition<T>) => Promise<T>` | Yes      | The `runChild` member uses the `<T>(definition: OperationDefinition<T>) => Promise<T>` contract. | [`OperationDefinition`](/tuil/docs/reference/packages/operations/api/operation-definition) |
| `block`          | `(message: string) => never`                            | Yes      | The `block` member uses the `(message: string) => never` contract.                               | —                                                                                     |
| `waitFor`        | `<T>(work: Promise<T>) => Promise<T>`                   | Yes      | The `waitFor` member uses the `<T>(work: Promise<T>) => Promise<T>` contract.                    | —                                                                                     |

## Parameters [#parameters]

This declaration has no public members.

## Returns [#returns]

This declaration does not return a value.

## Throws [#throws]

No thrown errors are documented for this declaration.

## Related types [#related-types]

* [`OperationDefinition`](/tuil/docs/reference/packages/operations/api/operation-definition)
* [`OperationProgress`](/tuil/docs/reference/packages/operations/api/operation-progress)

## Source [#source]

[View the secondary source reference](https://github.com/mwillbanks/tuil/blob/main/packages/operations/src/index.ts)

## Package [#package]

[@mwillbanks/tuil-operations](/tuil/docs/reference/packages/operations)
