{
  "id": "@typed/template/EventSource#makeEventSource",
  "canonicalId": "@typed/template#makeEventSource",
  "symbol": {
    "id": "@typed/template/EventSource#makeEventSource",
    "packageName": "@typed/template",
    "moduleName": "EventSource",
    "exportName": "makeEventSource",
    "kind": "function",
    "signatures": [
      "export declare function makeEventSource(): EventSource;"
    ],
    "summary": "Creates a new `EventSource`.\n\nThe created `EventSource` can efficiently manage multiple event listeners,\ngrouping them by event type and handling setup/teardown lifecycles.",
    "sections": {
      "Why": "The source is a small renderer-local registry that supports delegated\nlisteners without requiring a component runtime.",
      "Ownership and lifetime": "Construction allocates only the in-memory registry. Each `setup` call ties\nattached native listeners and forked handler Effects to the supplied Scope;\nreturned per-handler disposables remain independently usable."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect, Scope } from \"effect\"\nimport { makeEventSource } from \"@typed/template/EventSource\"\nimport * as EventHandler from \"@typed/template/EventHandler\"\n\nconst program = Effect.scoped(Effect.gen(function* () {\n  const eventSource = makeEventSource()\n  const element = document.createElement(\"div\")\n\n  // Add multiple event listeners\n  eventSource.addEventListener(element, \"click\", EventHandler.make(() => console.log(\"clicked\")))\n  eventSource.addEventListener(element, \"mouseover\", EventHandler.make(() => console.log(\"hovered\")))\n\n  // Setup all listeners\n  yield* eventSource.setup(element, yield* Scope.Scope)\n}))"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/template/src/EventSource.ts",
      "line": 168
    },
    "since": "1.0.0",
    "category": "Delegated event sources"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/template/EventSource#makeEventSource",
    "packageName": "@typed/template",
    "packageVersion": "1.0.0-beta.13",
    "moduleName": "EventSource",
    "consumerSpecifier": "@typed/template/EventSource",
    "exportName": "makeEventSource",
    "qualifiedName": "makeEventSource",
    "declarationKey": "declaration:890d071339c2ab78fb46a900",
    "family": "function",
    "signatures": [
      "export declare function makeEventSource(): EventSource;"
    ],
    "sourceSpans": [
      {
        "file": "packages/template/src/EventSource.ts",
        "start": {
          "line": 168,
          "column": 1
        },
        "end": {
          "line": 267,
          "column": 2
        }
      }
    ],
    "aliases": [
      "@typed/template#makeEventSource"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:890d071339c2ab78fb46a900",
    "name": "makeEventSource",
    "family": "function",
    "facets": [
      {
        "family": "function",
        "syntaxKind": "FunctionDeclaration",
        "signatures": [
          "export declare function makeEventSource(): EventSource;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/template/src/EventSource.ts",
            "start": {
              "line": 168,
              "column": 1
            },
            "end": {
              "line": 267,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare function makeEventSource(): EventSource;"
    ],
    "typeParameters": [],
    "summary": "Creates a new `EventSource`.\n\nThe created `EventSource` can efficiently manage multiple event listeners,\ngrouping them by event type and handling setup/teardown lifecycles.",
    "sections": {
      "Why": "The source is a small renderer-local registry that supports delegated\nlisteners without requiring a component runtime.",
      "Ownership and lifetime": "Construction allocates only the in-memory registry. Each `setup` call ties\nattached native listeners and forked handler Effects to the supplied Scope;\nreturned per-handler disposables remain independently usable."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect, Scope } from \"effect\"\nimport { makeEventSource } from \"@typed/template/EventSource\"\nimport * as EventHandler from \"@typed/template/EventHandler\"\n\nconst program = Effect.scoped(Effect.gen(function* () {\n  const eventSource = makeEventSource()\n  const element = document.createElement(\"div\")\n\n  // Add multiple event listeners\n  eventSource.addEventListener(element, \"click\", EventHandler.make(() => console.log(\"clicked\")))\n  eventSource.addEventListener(element, \"mouseover\", EventHandler.make(() => console.log(\"hovered\")))\n\n  // Setup all listeners\n  yield* eventSource.setup(element, yield* Scope.Scope)\n}))"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/template/src/EventSource.ts",
        "start": {
          "line": 168,
          "column": 1
        },
        "end": {
          "line": 267,
          "column": 2
        }
      }
    ],
    "since": "1.0.0",
    "category": "Delegated event sources"
  }
}
