docs: regenerate site from f094acfdb5
This commit is contained in:
commit
63c5ed9baf
975 changed files with 55427 additions and 0 deletions
45
annot-handles.html
Normal file
45
annot-handles.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>@Handles — Ludic</title>
|
||||
<meta name="description" content="Declarative hint naming the event or subsystem a handler is responsible for.">
|
||||
<link rel="stylesheet" href="base.css">
|
||||
<link rel="stylesheet" href="docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||||
<main class="wrap item">
|
||||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="api.html#annotations">Annotations</a> <span>›</span> <span class="here">@Handles</span></div>
|
||||
<div class="item-head">
|
||||
<span class="kind-badge kind-annotation">annotation</span>
|
||||
<h1 id="top">@Handles</h1>
|
||||
</div>
|
||||
<code class="sig">@Handles(Event) handler Name { … }</code>
|
||||
<div class="desc"><p><code>@Handles</code> is a declarative annotation that names the event or subsystem a handler (or a whole program) is responsible for. The parser accepts and records it as metadata for analysis and tooling — it does not by itself wire up dispatch, so it documents intent rather than driving execution. When you want a handler to actually run in response to an event, use <code>@On(Event)</code>, which registers the listener; <code>@Handles</code> is the companion label that makes ownership of an event legible across a modular codebase. Keep the named symbol a real event or system so the annotation stays meaningful.</p></div>
|
||||
|
||||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program CombatModule {
|
||||
property Health { current: int = 100 }
|
||||
model Enemy { Health }
|
||||
|
||||
event DamageDealt { amount: int = 0 }
|
||||
|
||||
@Handles(DamageDealt) # documents this handler's responsibility
|
||||
@On(DamageDealt) handler ApplyDamage { # @On does the actual dispatch wiring
|
||||
for (Health) in query [Health, {Enemy}] {
|
||||
Health.current = Health.current - amount
|
||||
}
|
||||
}
|
||||
|
||||
entry {
|
||||
spawn Enemy { Health { current: 100 } }
|
||||
emit DamageDealt(amount: 25)
|
||||
}
|
||||
}</pre></div>
|
||||
|
||||
<a class="back" href="api.html">← All symbols</a>
|
||||
</main>
|
||||
<script src="ludic-highlight.js"></script>
|
||||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||||
</body></html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue