{
  "id": "@typed/template#EventHandler.EventHandler",
  "canonicalId": "@typed/template/EventHandler#EventHandler",
  "symbol": {
    "id": "@typed/template#EventHandler.EventHandler",
    "packageName": "@typed/template",
    "moduleName": ".",
    "exportName": "EventHandler.EventHandler",
    "kind": "interface",
    "signatures": [
      "export interface EventHandler<Ev extends Event = Event, E = never, R = never> extends Pipeable {\n    readonly [EventHandlerTypeId]: EventHandlerTypeId;\n    readonly handler: (event: Ev) => Effect.Effect<unknown, E, R>;\n    readonly options: (AddEventListenerOptions & EventOptions) | undefined;\n}"
    ],
    "summary": "Represents a DOM event handler that returns an Effect.\n\nIt encapsulates the event handler logic and any options (like `preventDefault`, `once`, etc.)\nthat should be applied when the event is triggered.",
    "sections": {
      "Why": "`EventHandler` connects browser event behavior to an Effect program. When\ninstalled through `EventSource`, the callback receives a `Proxy` over the\nnative event: properties and bound methods forward to the browser event while\n`currentTarget` is overridden with the delegated target. The wrapper is not\npooled, but it is not object-identical to the native event.",
      "Ownership and lifetime": "`make` only describes the handler. A rendered template installs the listener\nwithin its Effect Scope and removes it when that rendered part is finalized.\nAny Effect returned by the callback keeps its error and required-service\nchannels in the `EventHandler<Ev, E, R>` type.",
      "Event options": "Native `AddEventListenerOptions` are passed through. Typed's convenience\nflags call the forwarded native methods before the handler; they do not\nintroduce a separate propagation or default-action system.",
      "Property: [[computed:[EventHandlerTypeId]]]": "Nominal evidence used by `isEventHandler`.",
      "Property: [[computed:[EventHandlerTypeId]]]: Why": "The key prevents arbitrary callback-shaped objects from becoming handlers.",
      "Property: [[computed:[EventHandlerTypeId]]]: Ownership and lifetime": "This field is immutable metadata for the handler description.",
      "Property: handler": "The Effect program invoked with the supplied event or delegated event proxy.",
      "Property: handler: Why": "The callback preserves typed failures and services while retaining browser\nevent behavior through the delegated proxy.",
      "Property: handler: Ownership and lifetime": "The mounted EventSource runs each Effect in a fiber owned by its Scope.",
      "Property: options": "Native listener options plus Typed's pre-handler event controls.",
      "Property: options: Why": "Browser capture, passive, signal, propagation, and default behavior stay explicit.",
      "Property: options: Ownership and lifetime": "EventSource reads this immutable record when attaching the listener."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as EventHandler from \"@typed/template/EventHandler\"\nimport { html } from \"@typed/template\"\n\n// Simple event handler\nconst handleClick = EventHandler.make((event: MouseEvent) => {\n  console.log(\"Clicked!\", event)\n})\n\n// Event handler with Effect\nconst handleSubmit = EventHandler.make((event: SubmitEvent) =>\n  Effect.gen(function* () {\n    event.preventDefault()\n    yield* Effect.sync(() => console.log(\"Form submitted\"))\n  })\n)\n\n// Use in template\nconst template = html`<button onclick=${handleClick}>Click me</button>`"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/template/src/EventHandler.ts",
      "line": 130
    },
    "since": "1.0.0",
    "category": "Event handlers"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/template#EventHandler.EventHandler",
    "packageName": "@typed/template",
    "packageVersion": "1.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/template",
    "exportName": "EventHandler",
    "qualifiedName": "EventHandler.EventHandler",
    "declarationKey": "declaration:ac97417d457b74f8d9967b54",
    "family": "interface",
    "signatures": [
      "export interface EventHandler<Ev extends Event = Event, E = never, R = never> extends Pipeable {\n    readonly [EventHandlerTypeId]: EventHandlerTypeId;\n    readonly handler: (event: Ev) => Effect.Effect<unknown, E, R>;\n    readonly options: (AddEventListenerOptions & EventOptions) | undefined;\n}"
    ],
    "sourceSpans": [
      {
        "file": "packages/template/src/EventHandler.ts",
        "start": {
          "line": 130,
          "column": 1
        },
        "end": {
          "line": 180,
          "column": 2
        }
      },
      {
        "file": "packages/template/src/EventHandler.ts",
        "start": {
          "line": 146,
          "column": 3
        },
        "end": {
          "line": 146,
          "column": 53
        }
      },
      {
        "file": "packages/template/src/EventHandler.ts",
        "start": {
          "line": 163,
          "column": 3
        },
        "end": {
          "line": 163,
          "column": 65
        }
      },
      {
        "file": "packages/template/src/EventHandler.ts",
        "start": {
          "line": 179,
          "column": 3
        },
        "end": {
          "line": 179,
          "column": 74
        }
      }
    ],
    "aliases": [
      "@typed/template/EventHandler#EventHandler"
    ],
    "isAlias": true,
    "parentId": "@typed/template#EventHandler",
    "static": false,
    "importedFrom": "declaration:ac97417d457b74f8d9967b54"
  },
  "declaration": {
    "declarationKey": "declaration:ac97417d457b74f8d9967b54",
    "name": "EventHandler",
    "family": "interface",
    "facets": [
      {
        "family": "interface",
        "syntaxKind": "InterfaceDeclaration",
        "signatures": [
          "export interface EventHandler<Ev extends Event = Event, E = never, R = never> extends Pipeable {\n    readonly [EventHandlerTypeId]: EventHandlerTypeId;\n    readonly handler: (event: Ev) => Effect.Effect<unknown, E, R>;\n    readonly options: (AddEventListenerOptions & EventOptions) | undefined;\n}"
        ],
        "typeParameters": [
          "Ev extends Event = Event",
          "E = never",
          "R = never"
        ],
        "sourceSpans": [
          {
            "file": "packages/template/src/EventHandler.ts",
            "start": {
              "line": 130,
              "column": 1
            },
            "end": {
              "line": 180,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly [EventHandlerTypeId]: EventHandlerTypeId;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/template/src/EventHandler.ts",
            "start": {
              "line": 146,
              "column": 3
            },
            "end": {
              "line": 146,
              "column": 53
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly handler: (event: Ev) => Effect.Effect<unknown, E, R>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/template/src/EventHandler.ts",
            "start": {
              "line": 163,
              "column": 3
            },
            "end": {
              "line": 163,
              "column": 65
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly options: (AddEventListenerOptions & EventOptions) | undefined;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/template/src/EventHandler.ts",
            "start": {
              "line": 179,
              "column": 3
            },
            "end": {
              "line": 179,
              "column": 74
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      }
    ],
    "signatures": [
      "export interface EventHandler<Ev extends Event = Event, E = never, R = never> extends Pipeable {\n    readonly [EventHandlerTypeId]: EventHandlerTypeId;\n    readonly handler: (event: Ev) => Effect.Effect<unknown, E, R>;\n    readonly options: (AddEventListenerOptions & EventOptions) | undefined;\n}"
    ],
    "typeParameters": [
      "Ev extends Event = Event",
      "E = never",
      "R = never"
    ],
    "summary": "Represents a DOM event handler that returns an Effect.\n\nIt encapsulates the event handler logic and any options (like `preventDefault`, `once`, etc.)\nthat should be applied when the event is triggered.",
    "sections": {
      "Why": "`EventHandler` connects browser event behavior to an Effect program. When\ninstalled through `EventSource`, the callback receives a `Proxy` over the\nnative event: properties and bound methods forward to the browser event while\n`currentTarget` is overridden with the delegated target. The wrapper is not\npooled, but it is not object-identical to the native event.",
      "Ownership and lifetime": "`make` only describes the handler. A rendered template installs the listener\nwithin its Effect Scope and removes it when that rendered part is finalized.\nAny Effect returned by the callback keeps its error and required-service\nchannels in the `EventHandler<Ev, E, R>` type.",
      "Event options": "Native `AddEventListenerOptions` are passed through. Typed's convenience\nflags call the forwarded native methods before the handler; they do not\nintroduce a separate propagation or default-action system.",
      "Property: [[computed:[EventHandlerTypeId]]]": "Nominal evidence used by `isEventHandler`.",
      "Property: [[computed:[EventHandlerTypeId]]]: Why": "The key prevents arbitrary callback-shaped objects from becoming handlers.",
      "Property: [[computed:[EventHandlerTypeId]]]: Ownership and lifetime": "This field is immutable metadata for the handler description.",
      "Property: handler": "The Effect program invoked with the supplied event or delegated event proxy.",
      "Property: handler: Why": "The callback preserves typed failures and services while retaining browser\nevent behavior through the delegated proxy.",
      "Property: handler: Ownership and lifetime": "The mounted EventSource runs each Effect in a fiber owned by its Scope.",
      "Property: options": "Native listener options plus Typed's pre-handler event controls.",
      "Property: options: Why": "Browser capture, passive, signal, propagation, and default behavior stay explicit.",
      "Property: options: Ownership and lifetime": "EventSource reads this immutable record when attaching the listener."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as EventHandler from \"@typed/template/EventHandler\"\nimport { html } from \"@typed/template\"\n\n// Simple event handler\nconst handleClick = EventHandler.make((event: MouseEvent) => {\n  console.log(\"Clicked!\", event)\n})\n\n// Event handler with Effect\nconst handleSubmit = EventHandler.make((event: SubmitEvent) =>\n  Effect.gen(function* () {\n    event.preventDefault()\n    yield* Effect.sync(() => console.log(\"Form submitted\"))\n  })\n)\n\n// Use in template\nconst template = html`<button onclick=${handleClick}>Click me</button>`"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/template/src/EventHandler.ts",
        "start": {
          "line": 130,
          "column": 1
        },
        "end": {
          "line": 180,
          "column": 2
        }
      },
      {
        "file": "packages/template/src/EventHandler.ts",
        "start": {
          "line": 146,
          "column": 3
        },
        "end": {
          "line": 146,
          "column": 53
        }
      },
      {
        "file": "packages/template/src/EventHandler.ts",
        "start": {
          "line": 163,
          "column": 3
        },
        "end": {
          "line": 163,
          "column": 65
        }
      },
      {
        "file": "packages/template/src/EventHandler.ts",
        "start": {
          "line": 179,
          "column": 3
        },
        "end": {
          "line": 179,
          "column": 74
        }
      }
    ],
    "since": "1.0.0",
    "category": "Event handlers"
  }
}
