This repository has been archived by the owner on Jul 1, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f967b6f
commit 30d98d0
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const {Document} = require('../basichtml'); | ||
const document = new Document(); | ||
|
||
// hyperHTML needs at least a global document | ||
// to perform an initial feature detection | ||
global.document = document; | ||
const hyperHTML = require('hyperhtml'); | ||
|
||
// most basic hyperHTML examples in node | ||
function tick(render) { | ||
console.log(render` | ||
<div> | ||
<h1>Hello, world!</h1> | ||
<h2>It is ${new Date().toLocaleTimeString()}.</h2> | ||
</div> | ||
`.innerHTML); | ||
} | ||
|
||
// start ticking | ||
setInterval(tick, 1000, hyperHTML.bind(document.body)); |