cyclejs
                                
                                 cyclejs copied to clipboard
                                
                                    cyclejs copied to clipboard
                            
                            
                            
                        Proposal: Make sources and sinks observables
Hi,
Working on @cylce/sandbox I ran into a problem, because of multi-threading the sinks from a web worker are returned asynchronously, thus I had to tell my Sandbox driver which expected sinks my component would have.
At CycleConf there was some discussion on MegaDrivers, but I think making Sinks and Sources an observable might be the right way to go.
It would allow a developer to patch a driver while the application is running, and could open up for better debugging tools.
The run function would look like this
run(main, xs.of({
  DOM: makeDOMDriver()
}))
And a component would look like this
function Component (sources$: Stream<Sources> ) { 
  return xs.of({
    DOM: xs.of(<div/>)
  });
}
This would also make it possible to reroute Components in the DevTool during run-time.
It could mitigate the pain of adding new drivers when a sub-component way down the tree has a certain driver dependency.
The migration for existing code would look as so
run(async(main), xs.of({
  DOM: makeDOMDriver()
}))
The async method would mount any synchronously bound component.
I believe it is outof scope of cycle/run itself, but should be just wrapper lib for run.