A small functional reactive programming library for JavaScript.
Questions tagged [bacon.js]
198 questions
2
votes
2 answers
Handling double clicks AND single clicks gracefully with FRP and Bacon.js
I'm trying to find the most graceful way to distinguish between single and double clicks in Bacon.js, but I feel like I'm not completely grasping how this works. The following works for detecting a double-click, but I'm a bit stumped as to how I…

Brendan
- 511
- 1
- 3
- 11
2
votes
1 answer
How to filter errors in a Bacon.js stream
Sometimes I want to filter out certain errors in a stream. I'd like to write something like this:
stream
.filterError (error) ->
error.type is 'foo'
But there is no filterError method.
As an alternative I thought I could use errors().mapError…

wolverian
- 43
- 1
- 5
2
votes
1 answer
Bacon.js lazy evaluation, mouse drag example breaks without log() statement
I'm trying to understand bacon.js and FRP so tried to make a simple drag and drop example, but I'm having trouble with the lazy evaluation of one piece of code. When I add a .log() into the stream it seems to look and act fine, but if I take it out,…

Paul Kaplan
- 2,885
- 21
- 25
2
votes
1 answer
how should I keep a running total of several values with bacon.js?
Messing around with a bacon.js. I'd like to keep a running total of values in a group of text inputs. The example on the github site uses .scan and an adder function, which works fine for the example because it's using -1 and +1 in the stream. But…

jcollum
- 43,623
- 55
- 191
- 321
1
vote
0 answers
Reactive Streams crazy card select sphagetti action
I have two cards, I want to select (highlight) a card when it is clicked.
If I mouse down on a card when there is a selection I want to move the selected card onto this one and not make a selection on mouse up (or click).
What I have tried:
let…

eguneys
- 6,028
- 7
- 31
- 63
1
vote
0 answers
what is the difference between eventstream zip and Bacon.when
I thought these were supposed to be equivalent but they are not:
// wrong
// let esDragStackCancelWithCards =
// esDragStackCancel.zip(esDragCardsEarly, fMergeArgs);
let esDragStackCancelWithCards =
Bacon.when(
…

eguneys
- 6,028
- 7
- 31
- 63
1
vote
1 answer
What is Bacon.js equivalent to Rx.JS' withLatestFrom()?
I'm trying to get use of atomic updates Bacon.js offers so have to rewrite Rx.JS code at some places of my app to Bacon.js, but can't figure out yet how can I implement withLatestFrom() with Bacon.js?
In such a way that, for example, when user…

Slaus
- 2,086
- 4
- 26
- 41
1
vote
1 answer
exponential time and inconsistent transient values when pushing a value in reactive programming?
I'm fairly new to reactive programming, and I'm starting to play with kefirjs.
On the face of it, it looks like bacon/kefir's event streams and properties are essentially a way to express a dependency/computation dag
that varies with time, and there…

Don Hatch
- 5,041
- 3
- 31
- 48
1
vote
2 answers
Refactor common combinators out of bacon.js streams
Let's say I have two bacon.js streams:
const stream1 = $('#input1').asEventStream('input')
.map(e => e.target.value)
.filter(inp => inp.length > 3)
.log();
const stream2 = $('#input2').asEventStream('input')
.map(e =>…

Dimitri Vorona
- 450
- 3
- 13
1
vote
1 answer
How to receive parameters sent from a socket.io emit event using baconJS?
I need some help with socket.io and bacon.JS:
I have on the client side a socket.IO emit event that sends 2 parameters to the server, as shown below:
$("#btn").asEventStream("click").onValue(function(){
socket.emit("event", param1,…

João Victor Oliveira
- 255
- 6
- 12
1
vote
2 answers
How do I configure BaconJS with Webpack and Coffee
I am porting legacy code to Webpack and I have the following...
Dependency loader in TS
import "baconjs/dist/Bacon.js"
Module in Coffee
@stream = new Bacon.Bus()
When I try to run I get
zone.js?fad3:269 Uncaught ReferenceError: Bacon is not…

Jackie
- 21,969
- 32
- 147
- 289
1
vote
1 answer
Bacon.js (FRP) - Add/remove values from array and save in storage
I'm new to Bacon.js and FRP concepts. I'm struggling with implementing very basic functionality. I have an array of saved values in some local storage:
['A', 'B', 'C']
I have an asynchronous function that reads these values from storage (returns…

Kosmetika
- 20,774
- 37
- 108
- 172
1
vote
3 answers
Bacon.js EventStream from value
Let's say I have an arbitrary value in my code:
var arbitraryValue = null;
There are multiple places in my code that can change this value. Can I create an EventStream which is based on the changes of the this value? In other words, if…

Jarzka
- 755
- 7
- 22
1
vote
1 answer
Can't import 'baconjs' into Angular 2 service
I am using angular-cli to create a new Angular 2 project. I am trying to add the 'baconjs' npm project, but having no success.
I am following the instructions here: https://github.com/angular/angular-cli/wiki/3rd-party-libs
The npm and typings…

George Madrid
- 703
- 7
- 16
1
vote
1 answer
Output list of items with baconjs
Can you suggest a better way to render list of items on my page with baconjs. I need opportunity to add/delete/change elements inside this list.
List of items should be a property, modified by events? Or something other?

Yuri Taratorkin
- 607
- 6
- 19