lbry.tech/views/components/html.js

25 lines
443 B
JavaScript
Raw Normal View History

2018-07-12 17:21:42 +02:00
"use strict";
// P A C K A G E
2018-07-13 23:58:24 +02:00
const html = require("choo-async/html");
2018-07-12 17:21:42 +02:00
2018-07-13 23:58:24 +02:00
// E X P O R T
2018-07-12 17:21:42 +02:00
2018-07-25 22:42:29 +02:00
module.exports = exports = (head, body) => (state, emit) => {
const bodyPromise = Promise.resolve(body(state, emit));
const headPromise = bodyPromise.then(() => head(state, emit)); // resolve `head` once `body` is resolved
return html`
<!DOCTYPE html>
<html lang="en">
${headPromise}
${bodyPromise}
</html>
`;
2018-07-13 23:58:24 +02:00
};