# Dialog.requestClose

Requests the native dialog close lifecycle, including its cancel event.

## Signatures

```ts
export declare function requestClose(state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>, returnValue?: string): Effect.Effect<void>;
```

## Why

The browser's `requestClose()` is cancelable. The fallback dispatches a real
cancelable `cancel` event and calls `close()` only when it is accepted, so
user handlers retain the same veto point.

## Ownership and lifetime

The Effect consults the dialog currently registered for the hydrated state;
registration is removed when `Content`'s Scope closes. No dialog is retained
after that finalizer.

## Examples

```ts
import { Effect } from "effect"
import * as Dialog from "@typed/ui/Dialog"

const program = Effect.gen(function* () {
  const state = yield* Dialog.makeState({ open: true })
  yield* Dialog.requestClose(state)
})
```
