There's no notion of event simultaneity in Bacon.js. Neither do the events carry a timestamp.
You can group roughly simultaneous events using stream.bufferWithTime(1)
. You'll get a stream of arrays of roughly simultaneous events.
If you need the time in the output, you can use stream.map(f)
with a function that combines the array with the current time.
So, something like this:
stream.bufferWithTime(1).map(function(events) {
return {
events: events,
timestamp: new Date().getTime()
}
})