Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
added hyperHTML example \o/
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Jun 13, 2017
1 parent f967b6f commit 30d98d0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -16,6 +16,7 @@
},
"devDependencies": {
"coveralls": "^2.13.1",
"hyperhtml": "^0.11.11",
"istanbul": "^0.4.5",
"tressa": "^0.3.1"
},
Expand Down
20 changes: 20 additions & 0 deletions test/hyperhtml.js
@@ -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));

0 comments on commit 30d98d0

Please sign in to comment.