Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 08 01:24
    Travis kefirjs/kefir (deps) passed (1274)
  • Jan 31 01:47
    desnor starred kefirjs/kefir
  • Jan 30 10:18
    Macil commented #292
  • Jan 29 20:29
    HitoriSensei synchronize #292
  • Jan 29 20:24
  • Jan 29 20:21
    HitoriSensei synchronize #292
  • Jan 29 20:19
    HitoriSensei commented #292
  • Jan 29 20:18
    HitoriSensei synchronize #292
  • Jan 29 20:03
    HitoriSensei commented #292
  • Jan 29 20:01
    HitoriSensei synchronize #292
  • Jan 25 13:29
    JordyBaylac starred kefirjs/kefir
  • Jan 23 10:19
    HitoriSensei commented #292
  • Jan 23 10:16
    HitoriSensei synchronize #292
  • Jan 23 07:49
    HitoriSensei commented #292
  • Jan 23 01:56
    Macil commented #292
  • Jan 23 01:45
    bsmithEG starred kefirjs/kefir
  • Jan 22 19:10
    Macil commented #291
  • Jan 22 19:09
    Macil commented #291
  • Jan 22 17:32
    HitoriSensei commented #292
  • Jan 22 16:47
    mAAdhaTTah commented #292
Christopher Hiller
@boneskull
:+1:
Philip Weaver
@philmaker1
I discovered Kefir.js a couple of days ago. I'm working on creating some practical examples and asking if anyone what's to help. The goal really is practical examples which illustrate why to use which features of Kefir. https://output.jsbin.com/fucuqus/
For example: illustrate how zip can be used to invoke a series of callbacks.
Illustrate why someone would what to use bufferBy...
Philip Weaver
@philmaker1
Another somewhat minor example: why would anyone ever use ignoreEnd?
Dan
@indigo0086
@philmaker1 isn't a handler invoked even on end?
Tom
@wow_0mg_twitter

I'm trying to observe a 'drop' event and fire an alert when an element has been dropped into it. By setting draggable="true" on the div being dragged it's able to identify the dropzone but doesn't look good.

I'd like to be able to move items between dropzones and know what items are in which dropzone.

like this --- http://jsfiddle.net/rniemeyer/Jr2rE/

Here is my code ---- http://codepen.io/tomsapps/pen/pEBawQ?editors=1000
Thanks for taking a look!

Philip Weaver
@philmaker1
Has anyone used Kefir to create a distributed message bus which supports pattern matching. Along the lines of Seneca.js, mesh.js, rxmq? I really like Kefir and would like a messaging system where I can work entirely in the browser and then transition portions over time to Node.
Frank Lemanschik
@frank-dspeed
can some one lend me a idea i want to code a crawler and i got stuck on the following situation: i get a array of urls now i want to request each and check if it has next and also emit results out of that request
so my problem is i want to perform 2 async action on one stream prob and want return a single stream
i tought about maybe using filter on it and filter out the urls that have a next page and then
filter out the once that don't got a next page but that don't goes deeper
so thats where i am hanging with handler could be a possible solution maybe?
so i get a single value that produces many values
but this values get async created :)
Frank Lemanschik
@frank-dspeed
Ah don't mind i got it working with a combination of flatten :)
and scan
Reko Tiira
@rekotiira

@rpominov I bumped to a situation like this with Kefir:

stream
    .flatMapConcat(it => Kefir.fromPromise(funcThatProducesPromise(it)))
    .log('value')

One would expect that there would only be one funcThatProducesPromise running at any given time, but for some reason Kefir calls the function that produces the flatmapped stream eagerly, and buffers the produced streams instead, effectively calling funcThatProducesPromise as soon as stream produces new value, even if the previous one is still running. To me this seems pretty confusing design choice, I think it'd be more logical to buffer the inputs and only call the producer function when the previous stream has ended (this obviously affects flatMapConcurLimit as well). I tested the same thing with Bacon to see whether it's just me who feels this is wrong, but seems like at least Bacon does it the way I'd expect. I "fixed" it by making the promise-function calling lazy by doing:

.flatMapConcat(it => Kefir.constant().flatMap(() => Kefir.fromPromise(funcThatProducesPromise(it))))

But still, I'm wondering if this can be considered as a "bug". It can lead to quite substantial bugs as well, for example in my case I was implementing a worker queue with concurrency limit using flatMapConcurLimit, and it worked fine when there weren't new jobs coming that often, but sometimes when multiple jobs started in short time, the worker queue ended up draining all connections from postgre pool, which caused the whole worker process to completely hang and not do anything. Nasty.

Roman Pominov
@rpominov
Hi, @rekotiira . Good question! Kefir runs function eagerly because these functions are supposed to be pure, and if laziness is required it supposed to be provided by streams themselves (a stream doesn't do side effects before one subscribes to it). But Promises do break this reasoning :(. Creating a promise is always effectfull if promise does something useful. I think what flatMapConcat does is correct, but there is a problem in Kefir.fromPromise API, it should also accept a function returning a promise, i.e. both Kefir.fromPromise(promise) and Kefir.fromPromise(() => promise) should work. I actually thought it's done that way already, but turns out it's not.
To clarify Kefir.fromPromise(() => promise) would call provided function lazily only when someone subscribes to the observable.
Sorry for super slow response, btw. Been very busy at work this week.
Vesa Karvonen
@polytypic
@rpominov What is your stance on optimizing Kefir? I've been reading the Kefir codebase and I believe there are several low hanging fruits for optimization. For example, every observable now includes a couple of extra fields (_logHandlers and _spyHandlers) for debugging. Eliminating those when they are not used would slow down things when debug features are used, but would reduce memory usage when they are not used. Another example is the way remove and add in Dispatcher work: a sequence of n add operations followed by n remove operations perform as O(n^2) (https://accidentallyquadratic.tumblr.com/). That can be improved so that typical patterns, i.e. remove in reverse order of add, run in O(n) time. A third example would be that the implementation currently seems to create lots of copies of event objects unnecessarily. Avoiding unnecessary copying could give a performance boost as avoiding allocations really seems to be one of the keys to improving JS perf. Shall I create PRs for these optimizations?
Roman Pominov
@rpominov
Hey, @polytypic ! After most.js came out I've gave up on optimizations in Kefir to be really honest. JS vms are so complicated, that you often get unexpected results from experiments with performance, and creating correct benchmarks is also very tricky business. One needs to be a real expert in vms to do this right. So don't expect any optimizations from me, haha :) . But if you want to work on this I'll gladly merge the PRs, but you will have to start from creating some benchmarks, so we would be sure those optimization work in practice :) . Or if you have a big app written using Kefir, benchmarking that app probably would be even better than synthetic micro benchmarks.
Vesa Karvonen
@polytypic
Sounds good. I'm also not interested in trying to optimize Kefir to match Most.js. (I'm actually quite familiar with the basic techniques/ideas that Most.js relies on. For example, I experimented with stream fusion a decade ago - damn I'm getting old.) The above are just some things I've actually observed when running my own (non-automated) frontend benchmarks. So, next time I see those issues in a profiler, I'll create a PR. :)
Roman Pominov
@rpominov
OK, sounds great!
Jack Jennings
@jackjennings
I build a small module for combining Kefir streams into a series of objects, but I'm stuck on what to call it: https://github.com/standard-library/kefir-spec
Currently I'm calling it "spec", but I don't like that this implies that it is a specification of Kefir—possibly "evolve" or maybe "blueprint"
Not sure what language to use here. Any thoughts?
Frank Lemanschik
@frank-dspeed
that exists already
if you merge 2 streams you get a serial stream
if you zip them you get always 2 pairs
the result of merge should be equal isn't it
i don't even understand your spec result :)
Jack Jennings
@jackjennings
The spec function takes a JS object where the values are streams, and emits objects in the same structure but with the last stream value in each key/value pair.
If this exists in core I would be happy to see how
Jack Jennings
@jackjennings
Juha Paananen
@raimohanska
This look almost exactly like Bacon.combineTemplate
There seems to be a Kefir version too: https://github.com/ahomu/kefir.combinetemplate
Jack Jennings
@jackjennings
✌️
Frank Lemanschik
@frank-dspeed
it looks a bit like what we do with canjs
and our can-computes and can-stream-kefir
if your searching for a dom diffing framework
that suports kefir streams to update values realtime
we have nice realtime template bindings for streams :D
Ahmed Fasih
@fasiha
Is there a way to reduce or fold a Kefir stream into a scalar value? I’m looking for max specifically.
Ahmed Fasih
@fasiha
Ah, I can scan and last :)
Inkata
@Inkata
Is this the right place to ask kefirjs questions?
Juha Paananen
@raimohanska
Damn right!