ripplejs / ripple

A tiny foundation for building reactive views
http://ripplejs.github.io
1.28k stars 66 forks source link

FRP constructs #37

Open matthewmueller opened 10 years ago

matthewmueller commented 10 years ago

Just read this excellent post: https://gist.github.com/staltz/868e7e9bc2a7b8c1f754

Seems like some of this stuff would be a good fit for ripple or maybe as plugins. What are your thoughts?

anthonyshort commented 10 years ago

Could be kinda cool to use streams for a lot of the data flow. Would be pretty easy to make a plugin to return a stream of data changes, so attributes were actually observable streams of values.

The bindings could just use those streams instead and each view could be a stream as well.

An event stream plugin would be nice for handling DOM events:

<a on-click="{{this.action}}">Click</a>
View.prototype.action = function(stream){
  stream
    .pipe(throttle(250ms))
    .map('a > 2')
    .map(this.clicked);
};