-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
36 lines (34 loc) · 1.11 KB
/
index.html
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
28
29
30
31
32
33
34
35
36
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0" />
<title>Quantum</title>
</head>
<body>
<div id="app"></div>
<script type="module">
import { render } from 'preact';
import { useEffect, useRef } from 'preact/hooks';
import { html, render as uRender } from 'uhtml';
import { attachRealm } from './src/index.js';
const root = document.getElementById('app');
const realm = attachRealm(root);
realm.observe(() => {
uRender(
realm.root,
html`<strong>${realm.childNodes.length ? realm.childNodes : 'Default content'}</strong>`
);
});
render('Hello World', root);
setTimeout(() => {
render('Hi there', root);
setTimeout(() => {
render(null, root);
}, 2000);
}, 2000);
</script>
</body>
</html>