react-pull-stream
Create a duplex stream from a react component.
Last updated 2 years ago by nichoth .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-pull-stream 
SYNC missed versions from official npm registry.

react pull stream

This is deprecated. See http://npm.im/@invintus/react-pull-stream

Create a duplex stream from a react component.

install

$ npm install react-pull-stream

example

var React = require('react')
var h = React.createElement
var reactDom = require('react-dom')
var S = require('pull-stream')
var toStream = require('../')

function MyView (props) {

    function click (n) {
        props.push(n)
    }

    return h('div', {
        className: 'app'
    }, [
        h('h1', { key: 'h' }, props.count),
        h('button', { key: 1, onClick: click.bind(null, 1) }, '1'),
        h('button', { key: 2, onClick: click.bind(null, 2) }, '2'),
        h('button', { key: 3, onClick: click.bind(null, 3) }, '3'),
    ])
}

MyView.defaultProps = { count: 0 }


// duplex stream
var stream = toStream(MyView, function onEnd (err) {
    console.log('its over')
})

var el = document.createElement('div')
document.body.appendChild(el)
reactDom.render(React.createElement(stream.view), el)

S(
    stream,
    S.map( n => ({ count: n }) ),
    stream
)

S(
    // you can have mulitple subscripbers
    stream.source.listen(),
    S.log()
)

stream.abort()  // end things

Current Tags

  • 2.0.3                                ...           latest (2 years ago)

14 Versions

  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
  • 0.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 7
Dependencies (5)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |