Socket
Book a DemoInstallSign in
Socket

virtual-dom-stream

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

virtual-dom-stream

Stream a virtual-dom tree as HTML

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
2
-50%
Maintainers
1
Weekly downloads
 
Created
Source

virtual-dom-stream stability

npm version build status test coverage downloads js-standard-style

Stream a virtual-dom tree as HTML. Useful to render virtual-dom / mercury nodes on the server.

Installation

$ npm install virtual-dom-stream

Usage

const vdom = require('virtual-dom-stream')
const h = require('virtual-dom/h')
const hs = require('hyperstream')
const bankai = require('bankai')
const http = require('http')

// render a vdom tree to html and append it to body in a stream
// and return it as a server response
const html = bankai.html()
http.createServer(function (req, res) {
  html(req, res)
   .pipe(hs({ body: { _appendHtml: vdom(createTree()) } }))
   .pipe(res)
}).listen()

function createTree () {
  return h('.greeting', [
    'hello world'
  ])
}

API

readableStream = virtualDomStream(tree)

Render a virtual-dom tree of h nodes to a readable stream.

See Also

License

MIT

Keywords

virtual-dom

FAQs

Package last updated on 28 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts