Juha Paananen @raimohanska
// var emails : Array<Email>
emails
.filter(function(mail) { return !isSpam(mail) })
.map(function(mail) { return mail.subject })
.forEach(show)
// var incomingEmailE : EventStream<Email>
incomingEmailE
.filter(function(mail) { return !isSpam(mail) })
.map(function(mail) { return mail.subject })
.forEach(show)
Distinct Events
Time-varying Value
incomingEmailE
inboxP
var socket = io(); // Connect with Socket.IO
socket.emit("get-mail"); // Request mail
var mailE = Bacon.fromEvent(socket, "mail"); // Wrap into Bacon
mailE
.map(".subject")
.onValue(bubble)
// Input: stream of messages to send
function MailClient(messagesToSendE) {
// Connect using Socket.IO, Websocket, TCP...
return { incomingMessagesE // Output: stream of incoming messages }
}
// Input: stream of messages to send
function Inbox(incomingMessagesE) {
return { inboxP: incomingMessagesE.scan([], ".concat") }
}
// Implement using JQuery, React, Native...
function Inboxview(inboxP) {
}