A small functional reactive programming library for JavaScript.
Questions tagged [bacon.js]
198 questions
1
vote
2 answers
Ignore/cancel/interrupt streams in Functional reactive programming?
Is there a way to cancel/ignore/interrupt a stream based on the output of another stream?
The use case is that I have 3 streams:
loginStream - user enters login creds and clicks submit. Emits login creds.
authorizeStream- system tries to authorize…

U Avalos
- 6,538
- 7
- 48
- 81
1
vote
1 answer
What is lazy evaluation in Bacon.js?
I am not able to understand what is lazy evaluation in Bacon.js.
I wrote the example provided by Bacon using map and flatMap and I get the same result.
Here is the HTML

Narayan Prusty
- 2,501
- 3
- 22
- 41
1
vote
1 answer
Should I unplug single-value stream from Bacon.Bus?
E.g.
var stream = new Bacon.Bus();
for(var i = 0; i < 4; i++) {
stream.plug(Bacon.later(3000, 'value');
}
Instead of for-loop I may have callback for some async thingy + other values are also being pushed into stream.

vadirn
- 1,715
- 4
- 15
- 16
1
vote
2 answers
Bacon.js Property new value and old value
Working with a POC using Bacon.js and run into a little bit of an issue with Property values.
I am able to retrieve all new property values in the onValue callback however I would like to know what the old property value was before this new value…

Moonwalker
- 3,462
- 4
- 25
- 31
1
vote
1 answer
Reactive javascript - convert ajax calls to Bacon.js stream with pagination
How can I convert calls to server API, with pagination support, to a Bacon.js / RxJs stream?
For the pagination I want to be able to store the last requested item-index, and ask for the next page_size items from that index to fill the stream.
But I…

avivr
- 2,573
- 3
- 22
- 34
1
vote
2 answers
Bacon.js combine properties with .and() only if prop === true
I've picked up Bacon.js recently and doing some UI with it in which I only enable a 'Sign up' button if the requirements are met, one of them is check that the username is valid.
// Returns true or string with invalid reason
var isUsernameValid =…

Mario
- 13
- 1
- 2
1
vote
3 answers
Complex operation with BaconJS (FRP)
I'm trying to do this relatively complex operation in BaconJs.
Basically, the idea is keep trying each check until you have a 'pass' status or they all fail. The catch is that 'pending' statuses have a list of Observables (built from jquery ajax…

U Avalos
- 6,538
- 7
- 48
- 81
1
vote
1 answer
Avoid memory leak in subscription for baconjs
I have a store in my application that uses the baconjs library.
This store listens for changes of my authentication token. As the logged in user changes I then want to update listeners on other events to depend this new token.
However, each time i…

Considerate
- 417
- 4
- 7
1
vote
1 answer
Dynamic piping with FRP
Consider a problem:
split file by lines
write lines to a result file
if a result file exceeds some size create a new result file
For example, if I have a file which weights 4gb and split size is equal 1gb. The result is four files weights 1gb.
I'm…

kharandziuk
- 12,020
- 17
- 63
- 121
1
vote
1 answer
form validation with baconjs
I recently started playing around with bacon.js, somehow I really like the idea of composing EventStream together in a functional reactive programming style.
I'm currently implementing form validation.
Current code:
var name =…

Seneca
- 2,392
- 2
- 18
- 33
1
vote
1 answer
How would I cancel a click event if it was following a drag event using Bacon.js?
So I have some event streams:
let mouseUps = $(window)
.asEventStream('mouseup');
let mouseDowns = $(window)
.asEventStream('mousedown');
let mouseMoves = $(window)
.asEventStream('mousemoves');
let drags = mouseDowns
.flatMapLatest(() =>…

Cyril Silverman
- 479
- 4
- 12
1
vote
1 answer
Use value of property from a different stream
Here's some simplified code. I press one button and it sets some config. Then when a user submits a form it needs to read the latest value of the config. I'm trying to be all FRP about it and avoid setting a normal variable.
var currentConfig =…

Ian Warburton
- 15,170
- 23
- 107
- 189
1
vote
1 answer
How can I pull a value out of a stream?
Functional reactive programming implementations seem to have the observer as being passively dependent upon streams providing them with values.
Is it possible to request a new value from down stream?
For example, if I have a stream that serves…

Ian Warburton
- 15,170
- 23
- 107
- 189
1
vote
1 answer
bacon.js - get value of stream/property
Probably it's simple question, but I can't resolve my problem. I have two streams and want mapping second stream by negative value of first stream.
jsfiddle - example
var price = change.map(1).scan(10, plus)
var money =…

doba
- 25
- 8
1
vote
0 answers
infinite recursive stream overflows
Please explain why the below stream overflows?
infiniteStream = function(page) {
return Bacon.fromBinder(function(sink) {
sink(page);
sink(new Bacon.Next(function() { return infiniteStream(page + 1); }));
}).flatMapConcat(function(v) {
…

user3995789
- 3,452
- 1
- 19
- 35