-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathhaunted.html
More file actions
27 lines (24 loc) · 753 Bytes
/
Copy pathhaunted.html
File metadata and controls
27 lines (24 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>hyperHTML & haunted</title>
</head>
<body>
<my-counter></my-counter>
<script type="module">
import { wire } from '../esm/index.js';
import { component, useState } from 'https://unpkg.com/@matthewp/haunted/haunted.js';
function Counter(el) {
const [count, setCount] = useState(0);
return wire(el)`
<div id="count">${count}</div>
<button type="button" onclick=${() => setCount(count + 1)}>Increment</button>
`.valueOf();
}
customElements.define('my-counter', component(Counter));
</script>
</body>
</html>