# `Skuld.Comp.ForeignSuspend`
[🔗](https://github.com/mccraigmccraig/skuld/blob/main/lib/skuld/comp/foreign_suspend.ex#L1)

Suspension for external/foreign resources (e.g., JavaScript Promises).

Like `InternalSuspend`, the `resume` function receives the env at resume
time — `(val, env) -> {result, env}`. This allows the scheduler to inject
updated shared state into the env before the continuation runs.

The `:payload` field is an opaque handle for the foreign platform to
resolve the suspension. Skuld treats it as a black box — it never inspects
or uses it directly. The Hologram JS runtime stores a Promise ref here;
other platforms would store whatever their event loop needs.

## Fields

- `id` — unique identifier (from `FreshInt.fresh_integer()`), used by the
  foreign platform to correlate a resolved resource back to this suspension
- `resume` — continuation, receives `(val, env) -> {result, env}`
- `payload` — opaque handle for the foreign platform

# `t`

```elixir
@type t() :: %Skuld.Comp.ForeignSuspend{
  id: term(),
  payload: term(),
  resume: (term(), Skuld.Comp.Env.t() -&gt; {term(), Skuld.Comp.Env.t()})
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
