A small functional reactive programming library for JavaScript.
Questions tagged [bacon.js]
198 questions
0
votes
1 answer
node.js events in router(emitter) and handlers(listeners)
My need is to generate custom events in router, that shall be based on the data that is coming from front-end. Like if the front-end object has handle_hello_world, then the router shall emit an event for handle_hello_world, so that the corresponding…

user3601166
- 127
- 2
- 13
0
votes
1 answer
Calculate the Cartesian product (xprod method) of two Observables
I have one interesting question. Maybe anybody know how could I implement a method like a http://ramdajs.com/docs/#xprod. I have one solution which I found:
let as = [1, 2, 3];
let bs = ['a', 'b', 'c'];
Rx.Observable.for(bs, b => {
return…

xgrommx
- 461
- 3
- 15
0
votes
1 answer
bacon.js: Strange behaviour with holdWhen and onValue
Take a look at the working CodePen here: http://codepen.io/djskinner/pen/JdpwyY
// Animation start events push here
var startBus = new Bacon.Bus();
// Animation end events push here
var endBus = new Bacon.Bus();
// Balance updates push here
var…

djskinner
- 8,035
- 4
- 49
- 72
0
votes
1 answer
Bacon.retry not retrying on 'Access-Control-Allow-Origin' errors
I have a buggy Web service that sporadically sends a 500-error "XMLHttpRequest cannot load http://54.175.3.41:3124/solve. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://local.xxx.me:8080' is therefore…

U Avalos
- 6,538
- 7
- 48
- 81
0
votes
1 answer
Never running stream Bacon.js. Callback never calls
I am trying to use Bacon stream as never ending loop but it doesn't work.
var Bacon = require('baconjs');
var INTERVAL = 300;
var tickStream = Bacon.interval(INTERVAL);
var isMaster = tickStream.flatMap(function() {
console.log('I never see the…

kharandziuk
- 12,020
- 17
- 63
- 121
0
votes
1 answer
How do I get the currenct value of a property?
First entry in the FAQ...
There is no getLatestValue method available and will not be either.
You get the value by subscribing to the stream/property (using
onValue) and handling the values in your callback
What if I'm not ready for the value at…

Ian Warburton
- 15,170
- 23
- 107
- 189
0
votes
1 answer
BaconJS Directory Structure Recursion Example
I'm just starting out on FRP and baconjs, so forgive my ignorance on terminology.
I am on a project where I'm trying to create a directory structure within google drive. I need to ensure the parent directories are created prior to the children…

Patricia M
- 15
- 3
0
votes
1 answer
bacon.js Bus.plug: Uncaught Error: not an Observable : [object Object]
I was trying baconjs's tutorial.
https://baconjs.github.io/tutorials.html#content/tutorials/2_Ajax
But, I got the error at "Bus.plug"
var cart = ShoppingCarEt([])
var cartView = ShoppingCartView(cart.contentsProperty)
var newItemView =…

Daishi Nakajima
- 1,932
- 18
- 26
0
votes
1 answer
Bacon.js `onError` not working
I have a function that calculates the aspect ratio of a height and a width input, and either throws an error, or returns an object with the aspect ratio.
var bestAR = dimensions.map(function(dim) {
try {
return findBestAR(dim.width,…

Arik
- 31
- 3
0
votes
2 answers
How to merge two properties in Bacon.js
Say I have two Bacon.js properties. One is child object - maybe just his name. The other property object with the outfit he or she is wearing - pants color and shirt color.
In my case I am using Angular-Bacon to create properties from AngularJS…

Michael Oryl
- 20,856
- 14
- 77
- 117
0
votes
1 answer
flatMapConcat with nested streams
I've asked "How to map a stream to lazy promise stream" with concurrency limit of 1 here: map a stream to lazy promise stream. The answer was flatMapConcat.
Now I have two nested streams, that needs concurrency limit of 1, and flatMapConcat no…

user3995789
- 3,452
- 1
- 19
- 35
0
votes
2 answers
How to exit nodejs at the end of the stream, so last values are saved to db, and log properly
I have a baconjs stream I use to save articles with mongoose. Here's the code:
function main() {
db.once('open', function(callback) {
console.log('db connection successs');
console.log('stremaing page ' + page);
var stream =…

user3995789
- 3,452
- 1
- 19
- 35
0
votes
1 answer
how to build a recursive stream for counting numbers
I want to build a custom stream, counting pages recursively:
var pageStream = function(page, limit) {
return Bacon.fromBinder(function(sink) {p
if (page >= limit) {
sink(new Bacon.End());
} else {
…

user3995789
- 3,452
- 1
- 19
- 35
0
votes
1 answer
Failed to convert NeDB Node callback to Bacon EventStream
Below the Node callback on NeDB worked correctly,
Datastore = require 'nedb'
db = new Datastore
db.insert a: 'Hi!', (err, docs) ->
console.log docs
Then tried to convert NeDB Node callback to Bacon EventStream,
Bacon =…

sof
- 9,113
- 16
- 57
- 83
0
votes
3 answers
Bacon.js stream with some okay errors
The result of a PUT operation against a database, is sometimes ok even if it doesn't come back as a HTTP code 200.
In this specific case I want to treat 400 as another okay error, but struggle to come up with an elegant way of doing it.
# stream…

Martin Algesten
- 13,052
- 4
- 54
- 77