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

An observable that yields for every capture click after the start button and before the stop button has been clicked.

// Setup observables
var buttonStart = $("#buttonStart").toObservable("click");
var buttonCapture = $("#buttonCapture").toObservable("click");
var buttonStop = $("#buttonStop").toObservable("click");

// Compose an event
var compose = buttonStart.SelectMany(function () {
    return buttonCapture.Select(function () {
        return "Captured Click";
        }).TakeUntil(buttonStop);
    });

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

Back (Zip)

Comments

Comment