This is the presentation for Composing Events with RxJS an Alt.Net Melbourne Lightning Talk.

An observable that yields when either button is clicked

// Setup observables
var button1 = $("#button1").toObservable("click").Select(function() {
    return "Button 1" });

var button2 = $("#button2").toObservable("click").Select(function() {
    return "Button 2"; });

// Compose an event
var compose = button1.Merge(button2)

// Subscribe to, and handle event
compose.Subscribe(function (result) {
    var val = $("<li/>").html(result);
    val.appendTo($("#results"));
});

Previous (Index) Next (Zip)

Comments

Comment