Questions tagged [bacon.js]

A small functional reactive programming library for JavaScript.

198 questions
2
votes
1 answer

FRP, angular and global event handlers

I just started using Bacon.js and it's truly awesome. Although sometimes I do struggle to find the right way of doing things. For example I want to have an angular directive with a draggable part. I shamelessly pick into someone's jsBin and tried to…
iLemming
  • 34,477
  • 60
  • 195
  • 309
2
votes
1 answer

Issues with implementing Bacon.JS to find average time spent per user on third party widget

I currently developing a third party widget for online publishers and would like to track its performance on different websites. I thought of implementing Upworthy's code (http://upworthy.github.io/2014/06/implementing-attention-minutes-part-1/) for…
ankits
  • 305
  • 1
  • 3
  • 13
2
votes
1 answer

Bacon.js and RxJS with Express.js and Mongoose.js

I'm using Bacon.js on the server side with Express.JS (version 4.x) This method never responds! Am I doing something extremely wrong here? var User = require('../data/User'); var Bacon = require('baconjs').Bacon; module.exports = function(router){ …
Max Alexander
  • 5,471
  • 6
  • 38
  • 52
2
votes
1 answer

Having different Bacon.js streams compute their values in the same intermittent window

Perhaps, having the Bacon.js hammer in hand, everything starts to look like a nail. But this feels like a problem that could be elegantly solved with it, and I don't have enough experience yet to figure it out. Many places in my application need to…
mhelvens
  • 4,225
  • 4
  • 31
  • 55
2
votes
1 answer

How to implement polling of a REST api in Bacon.js?

I've implemented a polling logic checking the status of a RESTful service returning the status of a backend job. I've run into the problem of shutting down the polling and solved it with an "unsubBus". I'm wondering if this could be solved in a…
flash42
  • 71
  • 6
2
votes
2 answers

How to react on a takeUntil stream in baconJS

I have 3 event streams for mouseDown, mouseUp and mouseMove. This works so far that when a user not hit the alt Key it does something on mouse move until mouse up. this.mouseDown .filter((e) =>!e.altKey) .flatMap(() =>…
Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297
2
votes
1 answer

Bacon.js: select, drag-drop with mouse and touch and move using arrow keys

We are writing an application like powerpoint, and we're considering bacon.js. There are elements like pictures, text, etc that can be dragged onto the screen, then selected, moved using mouse drag drop or touch events and using the arrow keys. I…
Dan Bunea
  • 187
  • 1
  • 2
  • 10
2
votes
1 answer

Subscribe to events that have no other subscribers

I am trying to implement a debug diagnostic in a browser based client and I need to detect events pushed to a Bacon bus that have no corresponding subscriber(s). Any ideas ?
Nicholas
  • 15,916
  • 4
  • 42
  • 66
2
votes
1 answer

Bacon.js "splitting" an event containing an array into multiple events for each element

I've recently discovered Bacon.js and have been tinkering but struggling with an issue. I have an event stream results for recent GitHub users returned from an AJAX request. Each result event is as an array of user objects, e.g., [{ id: 1, login:…
2
votes
1 answer

Combining Bacon.Bus values with value from promise

I am taking small steps in FRP land with BaconJS. I have the following code: # This will eventually get resolved with some value dfd = Promise.defer() promised = Bacon.fromPromise dfd.promise # Values are occasionally being pushed in here bus = new…
FredyC
  • 3,999
  • 4
  • 30
  • 38
2
votes
1 answer

How can an asynchronously loaded module get the latest value from a Bacon.js Bus?

I have a Bacon.Bus within an AMD module. define( 'bus', [ 'bacon' ], function( Bacon ){ return new Bacon.Bus(); } ); Other modules push values onto the bus. define( 'pusher', [ 'bus' ], function( bus ){ // ... bus.push( value ); //…
Jeff Rose
  • 163
  • 1
  • 10
2
votes
1 answer

Bacon.js observable.map with auto-catch

When working with partial mapping function (not every possible input is valid), I ended up making a small helper: function strictMap(property, f) { return property.withHandler(function (ev) { try { var x = ev.fmap(f); // force …
phadej
  • 11,947
  • 41
  • 78
2
votes
3 answers

How do I unsubscribe a handler in Bacon.js?

I'm learning to use the fantastic Bacon.js library for functional reactive programming. Adding handlers to a property or stream is easy: handler = function(value){... do something ...} property.onValue(handler) Say somewhere down the line I want to…
jpadvo
  • 6,031
  • 3
  • 26
  • 30
2
votes
1 answer

Bacon.js how to filter an event stream based on another property?

I have an event stream for when ENTER is presssed var enter = $('#text') .asEventStream('keydown') .filter(function(e){ return e.keyCode === 13 }) This works great. But, I want to only take action if ENTER is pressed and another…
airportyh
  • 21,948
  • 13
  • 58
  • 72
2
votes
1 answer

Does Bacon.js have some combinator that allows you to collect two events emitted at the same time?

As the title says, I am looking for some combinator collect that collects events emitted at the same time into a list, similar to the one found in Reactive-Banana. So in other words: collect :: EventStream a -> EventStream [a] collect [(time1, e1),…
xiaolingxiao
  • 4,793
  • 5
  • 41
  • 88