[go: up one dir, main page]

Skip to content

Working With Stream

James Yang edited this page Dec 14, 2016 · 1 revision

cssobj can use with stream libs like flyd, when stream update, it will auto update CSS.

DEMO on Jsfiddle

// html: <input><button>

import flyd from 'flyd'
import cssobj form 'cssobj'

const obj=flyd.stream({ p: {color: 'grey'} })
const result = obj.map(cssobj(obj()).update)

button.onclick = _ => obj({
  p: { color: input.value }
})

When user click on button, the color value will be applied to CSS, automatically.

Also, you can try flyd.combine, flyd.merge, flyd.scan, any thing javascript can does.

Clone this wiki locally