complate / complate-stream

complate's core library for rendering HTML via JSX
https://complate.org
6 stars 7 forks source link

simplify stringification #41

Open FND opened 5 years ago

FND commented 5 years ago

cf. a4afcf002014868841418989b34e804e093b61b2

import { createElement } from "complate-stream";
import BufferedStream from "complate-stream/src/buffered-stream";

let stream = new BufferedStream();
let element = MyMacro();
element(stream, { nonBlocking: true }, () => {
    let html = stream.read();
    …
});

this is a bit clunky and non-obvious, so we might simply provide a utility function to take care of all that:

stringify(MyMacro, params, ...children).
    then(html => …);