Fork me on GitHub


Less-than-pure Functional Reactive Programming for Javascript

"UI programming is groovy with event streams and behaviors." - me

Rather than ...why not ...
bind a callback to an event and mutating state map a function over an event stream
keeping UI details in mutable state express your UI's behavior as a function of time and event streams

Bind jQuery event streams and behaviors.

      .map(function(val) { return val.toUpperCase(); })

Bind backbone event streams and behaviors.

var model = new Backbone.Model({foo: "baz"});

      .map(function(currModel) { return currModel.get("foo") })

model.set({"foo" :  });

Polling-based animations use the same API and push-based events.

      .map(function(dt) { return 36*Math.abs(Math.sin(dt.getTime() / 1000.0)); })
      .changes({pollMillis: 50})
      .subscribe(function(v) { grow.attr("style", "font-size: " + v + "pt"); });

Now head over to the repo on github or read the the annotated source code and then read more about Functional Reactive Programming: