Questions tagged [bacon.js]

A small functional reactive programming library for JavaScript.

198 questions
0
votes
1 answer

bacon.js how to combine stream with another based on first ?

I have a stream daysFromApi$ with data (days with meals) from API. When a 'delete' button is clicked, I push mealId to this.deleteBus$. I want to have a new value in the stream: daysAfterDelete$. My problem is that 'first' event is always triggered,…
Jan Grz
  • 1,373
  • 14
  • 18
0
votes
1 answer

What are practical use cases for JavaScript Streams

I'm been learning how to use JavaScript 'node-style' streams using Bacon.js. Namely, I've been looking at the Bus EventStreams. It all looks very interesting and I'm sure that JavaScript streams have a multitude of great use cases, but I can't seem…
Adam McKenna
  • 2,295
  • 6
  • 30
  • 41
0
votes
1 answer

How do you group a stream, then process groups separately based on the group's key?

First of all, I'm fairly new to streams, so I'm still getting to grips with some common patterns. In many libraries we can split a stream into a stream of streams using .groupBy(keySelectorFn). For example, this stream is split into streams based on…
stephband
  • 2,594
  • 2
  • 23
  • 33
0
votes
1 answer

How do you return an ajax response object using Bacon.js?

The following code from Bacon.js will push the data object returned from the AJAX request into the console. Bacon.fromPromise($.ajax({ url : requestUrlString })).log() What is not clear, is how to assign the returned data object to a variable,…
typeofgraphic
  • 312
  • 4
  • 11
0
votes
1 answer

Bacon.js accumulator

my_Stream is data I want to accumulate and assign to variable for further processing. My question: How do I get the contents of the variable the_string to console.log ONCE THE STREAM IS FINISHED? my_Stream.onValue(function(value) { the_string =…
nogo10
  • 3
  • 2
0
votes
1 answer

Bacon.onEnd is not a function

When my system is creating errors, those are collected and finally sent to a ticket API. All errors are grouped by their type of priority. So, if two different error types are thrown, two tickets should be sent. Looks like: var tickets = [{ …
JoZeff
  • 45
  • 6
0
votes
1 answer

Use combineAsArray on Changing Set of Streams in BaconJS

Already found questions- how should I keep a running total of several values with bacon.js? I've already found the above question, which deals with a static set of properties. However, I'm interested in a variation, wherein the set of properties is…
ABMagil
  • 4,579
  • 4
  • 21
  • 35
0
votes
1 answer

Rate limiting with Bacon.JS

I'm trying to create a rate limiting when accessing an external API, using Bacon.JS The rate limiting works fine, using bufferWithCount and bufferingThrottle but i would like to get the results when everything is flatmapped, not each batch at a…
maephisto
  • 4,952
  • 11
  • 53
  • 73
0
votes
1 answer

Optional fields in baconjs form

I'm building customisable form in bacon.js. I have a problem with optional fields that can be empty e.g. phone is sometimes required or sometimes optional. field_events = _.merge( _.mapValues(@form, @_build_field_streams),…
Lukasz Madon
  • 14,664
  • 14
  • 64
  • 108
0
votes
1 answer

Stream processing in Kefir/Bacon.js

I have been working on a personal project involving real time data using Kefir (or Bacon.js, pick your favorite) and have gotten to a point where I need to log the data in a database to append an id, and then pass the object with the id down the…
codeape
  • 348
  • 1
  • 12
0
votes
1 answer

How can I create a Bacon.Property representing a property in a referenced object?

I have started playing with Bacon.js, and I have come across a problem I can't find any example for. I have a set of nodes, which may reference other nodes. It looks like this in imperative code: alice = { name: "Alice" } bob = { name: "Bob"…
Leventix
  • 3,789
  • 1
  • 32
  • 41
0
votes
1 answer

continuously loop through values in an array using Baconjs

I have an array of strings var strs = ['a','b','c'] and I want to use a Bacon.interval(2000) to return the values continuously to onValue The closest thing I can think of to create this is var stream = Bacon.interval(2000); var i =…
andykais
  • 996
  • 2
  • 10
  • 27
0
votes
1 answer

Wait for latest values from dependent ajax streams in BaconJS?

I have 3 streams. (1) gradingResult and contextId are ajax requests that depend on studentResponse. (2) For each studentResponse value, I need to fire an event with the studentResponse value and the corresponding result from the other two…
U Avalos
  • 6,538
  • 7
  • 48
  • 81
0
votes
2 answers

Wait for latest values from dependent streams in BaconJS?

I have 3 streams. gradingResult and contextId depend on studentResponse. I need to fire an event and only one event (otherwise, this is trivial) when all 3 have the latest values. I've tried #combineTemplate and #sampledBy studentResponse.…
U Avalos
  • 6,538
  • 7
  • 48
  • 81
0
votes
1 answer

What does merge and toProperty do in bacon.js

I have just started to working with bacon.js and trying to find out how does it work. On the following code asEventStream returns an eventStream and when in captures a blur event it emits a false value as I understand. What does the merge and…
user3814030
  • 1,263
  • 3
  • 20
  • 37