Fork me on GitHub

Behave.js

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.

Behave.jqueryInputB() 
      .map(function(val) { return val.toUpperCase(); })
      .changes()
      .subscribe(Behave.inputSink());

Bind backbone event streams and behaviors.

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

Behave.backboneModelB(model)
      .map(function(currModel) { return currModel.get("foo") })
      .subscribe(Behave.inputSink());

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

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

Behave.time
      .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: