我正在尝试从BaconJS制作zip example。但它不起作用。
var obs = Bacon.fromArray([{ x: 1, y: 2 },
{ x: 3, y: 4 }]);
var x = obs.map('.x');
var y = obs.map('.y');
var result = x.zip(y, function(x, y) {
return x + y;
});
// This doesn't work
// if `result` is replaced with `x` then it produces 1, 3 correctly
result.onValue(function(value) {
$("#events").append($("<li>").text(value))
});