lbry.tech/views/components/html.js
ポール ウェッブ c8926b8fa1 Refactoring and cleanup
2018-07-13 16:58:24 -05:00

27 lines
477 B
JavaScript
Executable file

"use strict";
// P A C K A G E
const html = require("choo-async/html");
// E X P O R T
module.exports = exports = (head, body) => {
return (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>
`;
};
};