Document the handle helper

This commit is contained in:
Talia 2022-04-12 22:44:53 +02:00
parent f7b945c083
commit cdc5978897
Signed by: darkwiiplayer
GPG Key ID: 7808674088232B3E
1 changed files with 15 additions and 0 deletions

View File

@ -314,6 +314,21 @@
</p>
</section>
<section>
<h2>The <code>handle</code> helper</h2>
<p>
This helper function takes an event handler and wraps it in a new
function that calls <code>preventDefault</code> on the event before
passing it to the original function.
</p>
<code-block>
html.form(html.button({
click: handle(event =&gt; console.log("I'm not submitting anything"))
}))
</code-block>
</section>
<section>
<h2>The <code>empty</code> constant</h2>