> ## Documentation Index
> Fetch the complete documentation index at: https://docs.summerengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SummerOperation

> Single-terminal asynchronous operation for the Summer runtime.

**Class:** `SummerOperation` · **Inherits:** RefCounted

Single-terminal asynchronous operation for the Summer runtime.

Completes exactly once on the main thread with a [`SummerResult`](/api-reference/gdscript/types/result). Deferred operations are owned by a revocable Summer queue until terminal queue cleanup, including cancellation, so dropping the caller reference cannot strand a queued completion. Use [`get_result_or_completed_signal()`](/api-reference/gdscript/types/operation#get_result_or_completed_signal) when awaiting from GDScript so a synchronously published scheduling failure cannot be missed. Scene module teardown revokes queued dispatch and publishes cancellation without invoking script callbacks. Scripts may observe or cancel an engine-created operation but cannot construct or complete one.

## Properties

| Property | Type | Access | Description |
| - | - | - | - |
| <a id="result" />`result` | [`SummerResult`](/api-reference/gdscript/types/result) | read-only, `get_result()` | Terminal result, or `null` while pending. |
| <a id="state" />`state` | [`SummerOperation.State`](/api-reference/gdscript/types/operation#state) | read-only, `get_state()` | Current single-terminal state. |

## Methods

### cancel

```gdscript theme={null}
func cancel() -> bool
```

Requests cancellation on the main thread. Returns `true` only when cancellation wins while pending. The terminal result then has code `&"cancelled"`.

**Returns:** bool

### get\_result\_or\_completed\_signal

```gdscript theme={null}
func get_result_or_completed_signal() -> Variant const
```

Returns the terminal [`SummerResult`](/api-reference/gdscript/types/result) when already complete, or the [`completed`](/api-reference/gdscript/types/operation#completed) signal while pending. On the main thread, `var result: SummerResult = await operation.get_result_or_completed_signal()` is race-free even when deferred scheduling fails synchronously before the operation is returned. Do not await [`completed`](/api-reference/gdscript/types/operation#completed) directly unless the pending state was established without a gap.

**Returns:** Variant

### is\_cancelled

```gdscript theme={null}
func is_cancelled() -> bool const
```

Returns whether cancellation won and the operation reached [`STATE_CANCELLED`](/api-reference/gdscript/types/operation#state_cancelled).

**Returns:** bool

### is\_completed

```gdscript theme={null}
func is_completed() -> bool const
```

Returns whether the operation completed normally, including a structured failure result.

**Returns:** bool

### is\_pending

```gdscript theme={null}
func is_pending() -> bool const
```

Returns whether no terminal result has been published.

**Returns:** bool

## Signals

### completed

```gdscript theme={null}
signal completed(result: SummerResult)
```

Emitted once after internal runtime state bookkeeping for observable terminal transitions, so continuations observe terminal singleton state. Scene module teardown suppresses this signal while revoking queued dispatch.

## Enums and constants

### State

| Name | Value | Description |
| - | - | - |
| `STATE_PENDING` | `0` | No terminal result has been published. |
| `STATE_COMPLETED` | `1` | Completed normally with a success or structured failure result. |
| `STATE_CANCELLED` | `2` | Cancellation won and published a cancellation result. |

***

What is live on the platform today: [platform capability status](/knowledge-base/source-status). Check availability at runtime before you offer a feature.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.