marko-for-stream

1.0.2 • Public • Published

for-stream

A marko 4.0 component that renders async content coming from a readable stream which can be a string or an object.

Installation

npm install marko-for-stream

Usage

<for-stream(varName from data.myDataStream) timeout="500">
    <div>${varName}</div>
</for-stream>
template.render({
    myDataStream: stream
}, response)

In case you need to handle stream data as a group of chunks, for example to render rows in the table, you can use the batchSize attribute:

<for-stream(row from data.myDataStream) batchSize="3">
    <tr>
        <for(varName in row)>
            <td>${varName}</td>
        </for>
    </tr>
</for-stream>

Package Sidebar

Install

npm i marko-for-stream

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • dimichgh