canjs / can-stream-kefir

Stream values into and out of computes
https://canjs.com/doc/can-stream-kefir.html
MIT License
3 stars 2 forks source link

Stop using can-compute #57

Open m-mujica opened 6 years ago

m-mujica commented 6 years ago

Alternative interface suggested by @justinbmeyer

{
   toStreamFromValue: function(source){
       Kefir.stream(function(emitter){
           Reflect.onValue(source, function(value){
               emitter.value(value)
           })
           emitter.value(Reflect.getValue(source))
       });
   },
   toStreamFromValueAndErrorKeys: function(source){
       Kefir.stream(function(emitter){
           Reflect.onKeyValue(source, "value",function(value){
               emitter.value(value)
           },"notify")
           Reflect.onKeyValue(source, "error",function(value){
               emitter.error(value)
           },"notify")
           emitter.value(Reflect.getKeyValue(source,"value"))
       });
   },
   toReflectedValue: function() {
       {can.getValue, can.onValue}
   }  
}