# EventHandler.provide

Provides services to the `EventHandler`.

This allows you to inject dependencies into the effect returned by the event handler.

## Signatures

```ts
export declare const provide: {
    <R2 = never>(services: Context.Context<R2>): <Ev extends Event, E = never, R = never>(handler: EventHandler<Ev, E, R>) => EventHandler<Ev, E, Exclude<R, R2>>;
    <Ev extends Event, E = never, R = never, R2 = never>(handler: EventHandler<Ev, E, R>, services: Context.Context<R2>): EventHandler<Ev, E, Exclude<R, R2>>;
};
```

## Why

Providing a `Context` at the handler boundary narrows its required-service
channel while preserving the delegated event proxy and listener options.

## Ownership and lifetime

The supplied services are captured by the returned description. Listener and
handler-fiber lifetime still belong to the renderer's Scope.

## Examples

```ts
import { Effect, Context } from "effect"
import * as EventHandler from "@typed/template/EventHandler"

interface Database {
  readonly save: (data: string) => Effect.Effect<void>
}
const Database = Context.Service<Database>("Database")

const handler = EventHandler.make((_event) => Effect.gen(function* () {
  const database = yield* Database
  yield* database.save("data")
}))

// Provide services
const services = Context.make(Database, {
  save: (data) => Effect.sync(() => console.log(data))
})
const provided = EventHandler.provide(handler, services)
```
