These are chat archives for pozadi/kefir

27th
Feb 2016
Sergey Lapin
@lapanoid
Feb 27 2016 14:44

@rpominov one more question on this matter, even if I create 'enableStream' I still need to emit vaules, and

 let emitter;
  const outStream = Kefir.stream(_emitter => {
    emitter = _emitter;
  });

seems ugly, is it right way to emit?

Roman Pominov
@rpominov
Feb 27 2016 16:04
@lapanoid yes, this is how it can be done. It was deliberately made inconvenient so people would try and find better ways to create streams. What is your source of events for enableStream i.e., when and where you call emitter.emit(true / false)? Maybe we'll find a better way in your case too.
Sergey Lapin
@lapanoid
Feb 27 2016 16:16
I try to find solution for scroll in react, this includes section routing and animation, I need to disable scroll events during animation and enable after for example. Most important that I need to pass emmiter
I do smth like this currently
const createEmmiterStream = ()=>{
  let emitter;
  const stream = Kefir.stream(_emitter => {
    emitter = _emitter;
  }); 

  return {
    emitter,
    stream
  }
}
Roman Pominov
@rpominov
Feb 27 2016 16:32
How do you start/stop the animation?
Sergey Lapin
@lapanoid
Feb 27 2016 16:33
Could be various ways react-motion(with hack) or greensock can do that end of css animation also can be tracked
Roman Pominov
@rpominov
Feb 27 2016 16:38
I see, well not sure we can avoid the Bus/Subject/Emitter pattern here, need to look at the real code to see if it's possible. But looks like Bus/Subject/Emitter may be the only option indeed in your case, if so something like createEmmiterStream is right solution, I would do something like that.
Sergey Lapin
@lapanoid
Feb 27 2016 17:07
@rpominov thanks for support)
Roman Pominov
@rpominov
Feb 27 2016 18:28
no prob :ok_hand: