Выступление Дмитрия Кириенко и Алексея Осипенко на ноябрьской встрече Донецкого Лямбда-клуба.
http://l.dn.ua/
http://dimoneverything.blogspot.com/2013/11/blog-post.html
5. $("#login").on("click", function (event) {
var value = $(event.target).val();
if (value.length > 0) {
$("#notice").text(value);
var clickE = $("#login").events("click");
clickE.onValue(function (event) {
var value = $(event.target).val();
if (value.length > 0) {
$("#notice").text(value);
}
});
}
});
6. $("#login").on("click", function (event)
{
var value = $(event.target).val();
var clickE = $("#login").events("click");
var values = clickE.map(function (event) {
return $(event.target).val();
});
var nonEmptyValues = values.filter(function (value)
{
return value.length > 0;
});
nonEmptyValues.onValue(function (value) {
$("#notice").text(value);
});
if (value.length > 0) {
$("#notice").text(value);
}
});
7. $("#login").on("click", function (event) {
var value = $(event.target).val();
var values = $("#login").events("click")
.map(function (event) {
return $(event.target).val();
}).filter(function (value) {
return value.length > 0;
});
values.onValue(function (value) {
$("#notice").text(value);
});
if (value.length > 0) {
$("#notice").text(value);
}
});
8. $("#login").on("click", function (event)
{
var values = $("#login").events("click")
.map(chain(pluck('target'), $, method('val'))
.filter(nonEmpty);
values.onValue(function (value) { $("#notice").
text(value); });
var value = $(event.target).val();
if (value.length > 0) {
$("#notice").text(value);
}
});
9. type Stream[a] = [(T, a)]
type Box[a] = T -> a
A
B
C
Stream will receive B and C
A
B
C
Box immediately receives A and will receive
B and C
10. new Stream( function (sink) {
sink(new Event(10));
sink(new Event(20));
return function() {};
});
15. asyncCall(data, function (response) {
// You have response from your asynchronous call here.
}, function (err) {
// if the async call fails, the error callback is
invoked
});
16. asyncCall(data,function(response){
// You have response from your asynchronous call here.
}, function(err){
// if the async call fails, the error callback is
invoked
});
var promise = asyncCall(data);
promise.done(function(response){
// You have response from your asynchronous call here.
}).fail(function(err){
// if the async call fails, you have the error response
here.
});