A small functional reactive programming library for JavaScript.
Questions tagged [bacon.js]
198 questions
87
votes
1 answer
Node.js Streams vs. Observables
After learning about Observables, I find them quite similar to Node.js streams. Both have a mechanism of notifying the consumer whenever new data arrives, an error occurs or there is no more data (EOF).
I would love to learn about the…

urish
- 8,943
- 8
- 54
- 75
69
votes
5 answers
How is reactive programming different than event-driven programming?
I am learning reactive programming and functional reactive programming in JavaScript. I am very confused.
Wikipedia says that there are various ways to write reactive code such as imperative, OORP and functional. I want to know if event-driven is…

Narayan Prusty
- 2,501
- 3
- 22
- 41
18
votes
1 answer
Does Functional Reactive Programming in JavaScript cause bigger problems with listener references?
In JavaScript the observer pattern is used quite often. There is one tricky thing with it and that's the references the subject keeps of the observers. They require cleanup. For regular applications I use the following rules of thumb:
If the…

EECOLOR
- 11,184
- 3
- 41
- 75
13
votes
3 answers
Javascript: what does function(_) mean
I'm going through the bacon.js slide at:
http://raimohanska.github.io/bacon.js-slides/1.html
In the 1st line of the 2nd block, it says:
function always(value) { return function(_) { return value } }
what does function(_) mean?

tldr
- 11,924
- 15
- 75
- 120
11
votes
2 answers
How to interleave streams (with backpressure)
Suppose I have two possibly infinite streams:
s1 = a..b..c..d..e...
s2 = 1.2.3.4.5.6.7...
I want to merge the streams and then map merged stream with slowish asynchronous operation (e.g. in Bacon with fromPromise and flatMapConcat).
I can combine…

phadej
- 11,947
- 41
- 78
10
votes
2 answers
Advantage of Functional Reactive Programming over event-listeners
I've been hearing a lot about functional reactive programming, and decided to check out what the big deal is. Going through the bacon.js documentation, it seems that the main difference is that instead of setting an event listener on a component, I…

tldr
- 11,924
- 15
- 75
- 120
9
votes
2 answers
Using Bacon.js to disable submit button while deferreds are "pending"
I have a form, which has many image urls - the back-end persists url strings and the images are uploaded directly to S3. I'd like to use Bacon.js streams to handle disabling/enabling the form's submit button while uploads are in-progress.
I've tried…

pdoherty926
- 9,895
- 4
- 37
- 68
8
votes
2 answers
How to handle mouse and touch events simultaneously with reactive event streams
I'm building an audio playback control that lets users scrub back and forth through an audio file. It needs to work with touch and mouse events. How should I go about managing the events for this with reactive event streams?
Here's a rough idea of…

Jesse Hattabaugh
- 7,876
- 8
- 34
- 38
6
votes
2 answers
Fighting with FRP
I've read about FRP and was very excited.
It looks great, so you can write more high-level code, and everything is more composable, and etc.
Then I've tried to rewrite my own little game with a few hundreds sloc from plain js to Bacon.
And I found…

iofjuupasli
- 3,818
- 1
- 16
- 17
5
votes
2 answers
Ignore events on stream until condition is satisfied?
I created a stream from button click events. The button corresponds to a create action on the database. Obviously, I want the database action to fire only once (at least until it completes). Is there a way to ignore events on createButtonStream…

U Avalos
- 6,538
- 7
- 48
- 81
4
votes
1 answer
RxJS alternative to Bacon.combineTemplate
Can anyone provide a function which can be Bacon.combineTemplate alternative written in RxJS?

gyzerok
- 1,338
- 2
- 11
- 26
4
votes
1 answer
Observable.flatMapLatest: Cancel at a deeper level?
I'm experimenting with reactive programming for the first time, using bacon.js, and hit an odd interaction that's annoying me. I came up with a working version of this event chain, but the hackish extra stream manipulations makes it stand out from…

mrkishi
- 5,602
- 1
- 20
- 18
4
votes
2 answers
Circular dependencies of EventStreams in FRP
All examples uses Ramda as _ (it's clear what methods do in examples contexts) and kefir as frp (almost same API as in bacon.js)
I have a stream, that describes change of position.
var xDelta = frp
.merge([
up.map(_.multiply(1)),
…

iofjuupasli
- 3,818
- 1
- 16
- 17
4
votes
1 answer
Bacon.js: practical difference between a stream and a property
As a newcomer to bacon.js, I can't seem to understand the difference between an event stream and a property.
Properties are built from streams (except properties built with .constant?)
They have most methods in common
Subscribing to them works in…

Nicolas Le Thierry d'Ennequin
- 6,004
- 5
- 37
- 56
4
votes
2 answers
Separating single clicks from click and hold
I need to implement a behavior:
when element clicked - one thing happens
but when it's clicked and held for more than one second, something else happens (e.g element becomes draggable) and then the first event never fires
I think I know how to…

iLemming
- 34,477
- 60
- 195
- 309