A small functional reactive programming library for JavaScript.
Questions tagged [bacon.js]
198 questions
1
vote
1 answer
FRP complex state - immutability vs performance
My question is about mutability of 'state machine' object in FRP. I'm evaluating Bacon.js's Observable.withStateMachine.
My domain is trading robots. I've got a source event stream of 'Orders' which actually are tuples (buy or sell,price,volume)
I…

user2732200
- 23
- 4
1
vote
1 answer
Convert async.waterfall to Bacon
I'm trying to integrate Baconjs into my current Nodejs project, in this project I used Async https://github.com/caolan/async to handle callbacks. One of the methods is async.waterfall
that is now I want to port it to Bacon, using…

dee
- 23
- 3
1
vote
1 answer
How do I prevent event cycles with FRP (and bacon.js)
I've managed to create a cycle in my bacon-powered application, so I need some advice on how to break it.
Let's say we have several properties which carry some state of the application. This state is supposed to be stored via HTML5 History API…

Nikolai Prokoschenko
- 8,465
- 11
- 58
- 97
1
vote
1 answer
How can I express the initial processes by Bacon.js in place of Promise?
I alway do something like this for initial processes:
$.when(dom(), webrtc(), websocket('wss://example.com/'), sleep(3000)).then(load, fail);
dom, webrtc, websocket, and sleep are Promise objects. This expression is useful to load some parallel…

Japboy
- 2,699
- 5
- 27
- 28
1
vote
1 answer
Why does a Bacon.combineAsArray Stream of 'keyup' events immediately end?
I need to create a Bacon.Property that gets either true or false if multiple html input contain their correct char. (They all have to be correct, if not, the property needs to be false)
To achieve this, I created an Array of eventStreams via…

jukempff
- 965
- 6
- 12
1
vote
1 answer
bacon.js EventStream representing polling of url at interval
I want to poll a url regularly and get the results as a stream. I'm probably missing something obvious but does anyone know how to do this seemingly simple thing in bacon.js?

Kaleidoscope
- 3,609
- 1
- 26
- 21
1
vote
2 answers
Bacon.js, delay each value in the stream by 1 second
I have this:
var bulk = array[1,2,3,4]
var finalResult = Bacon
.fromArray(bulk)
.flatMap(isValInCouchDb)
.filter(onesThatExist)
.flatMap(putValInCouchDb)
I need right after the filter to delay the whole stream by 1 second and then…

haknick
- 1,892
- 1
- 20
- 28
1
vote
1 answer
How do I delay a Bacon.js stream until a value on another stream?
Given two Bacon.Buses I need to combine their respective values. However, the second bus is vastly more "productive" (about 1:200), the first bus is also slower and its first value is severely delayed, e.g. fetched via XHR or something similar.…

Nikolai Prokoschenko
- 8,465
- 11
- 58
- 97
1
vote
1 answer
How can I combine a current value of a stream with each value of another stream in bacon.js?
In my application I have a state object state, which is mutated by GUI elements. Each time this state is mutated, an XHR is executed to update the state server-side and current state is returned. This maps nicely to Bacon.js' streams.
Now, assuming…

Nikolai Prokoschenko
- 8,465
- 11
- 58
- 97
1
vote
1 answer
List in a Container with Bacon.js
I have a list of elements and a container for the list. (They are implemented with Marionette + Backbone views).
What I'd like to do is register a click on the list and send it to the container with bacon.js or something similar.
This is fairly easy…

Archaeron
- 767
- 1
- 7
- 15
1
vote
1 answer
Bacon.js onValue() chain
Why the construction like
$("#clickme").asEventStream('click').onValue(callback1).onValue(callback2);
doesn't work, but this one
var promise = $("#clickme").asEventStream('click');
promise.onValue(callback1);
promise.onValue(callback2);
works.…

speedingdeer
- 1,236
- 2
- 16
- 26
1
vote
1 answer
How do I get the status of an Ajax call in Bacon.js?
jQuery's Ajax handler returns an array of arguments when its promise resolves, and the initial tuple is ([data], "status"). I've found that when I use Bacon.fromPromise, all I get back is the data. How would I get the status of the transaction,…

Elf Sternberg
- 16,129
- 6
- 60
- 68
1
vote
1 answer
Control flow in bacon.js, how to do something at a given time
So I'm fairly new to the functional programming paradigm and especially new to Bacon.js and FRP.
I need some advice on how to conceptualize control flow in FRP. I have a timer in an event stream that counts down to zero. When it has reached zero I…

droidballoon
- 720
- 10
- 17
1
vote
1 answer
Is it possible to throttle the bacon action `repeatedly` somehow?
I am using bacon.js and have some situation where signal is emitted from two sources:
sourceA :: EventStream a
sourceB :: EventStream Bool
When sourceA is fired, it should trigger some action that runs repeatedly onto perpetuity, except when a…

xiaolingxiao
- 4,793
- 5
- 41
- 88
1
vote
1 answer
combineWith vs onValues in Bacon.js
I have 2 Bacon.jQuery Models (but the problem can be illustrated with any Bacon Observable).
I have 3 combo boxes: foo, bar and quux. bar depends on foo and quux depends on a combination of bar and quux. There is a findQuux function which finds a…

nponeccop
- 13,527
- 1
- 44
- 106