Improve skooma post
This commit is contained in:
parent
6346a2892e
commit
6f54e0050a
1 changed files with 4 additions and 2 deletions
|
@ -30,7 +30,7 @@ Given the many similarities between Lua and JavaScript, it was only a matter of
|
|||
|
||||
## Features
|
||||
|
||||
Skooma is best explained by exmaple, as a big part of the point is the (relatively) clean-looking code that looks *somewhat* like a purpose-built DSL.
|
||||
Skooma is best explained by example, as a big part of the point is the (relatively) clean-looking code that looks *somewhat* like a purpose-built DSL.
|
||||
|
||||
```js
|
||||
import {html} from '/skooma.js'
|
||||
|
@ -56,7 +56,9 @@ The outermost `div` tag is given three other tags as its children, and an object
|
|||
Since passing functions into HTML attributes makes no sense, this case is used for setting event handlers instead:
|
||||
|
||||
```js
|
||||
html.button("Click me!", {click: event => alert("Button has been clicked!")})
|
||||
html.button("Click me!", {
|
||||
click: event => alert("Button has been clicked!")
|
||||
})
|
||||
```
|
||||
|
||||
This internally uses `addEventListener` instead of setting an `onclick` attribute, so this even lets one add several handlers of the same type, albeit in separate objects.
|
||||
|
|
Loading…
Reference in a new issue