Closed lmatteis closed 7 years ago
@goshakkk @nickbalestra I'm thinking of this:
// `Cycle` can be xstream or rxjs or anything else
var output = Cycle.run(main, { ACTION: makeActionDriver(), STATE: makeStateDriver() })
const cycleMiddleware = createCycleMiddleware(output);
Problem is that the ACTION driver needs access to store
so we need to create the drivers in the middleware (as it is now).
Maybe we can just keep the API as it is, but add an extra arg to createCycleMiddleware
which is the actual run
method to use internally:
import {run} from '@cycle/xstream-run';
const cycleMiddleware = createCycleMiddleware(main, { HTTP: makeHTTPDriver() }, run);
Thoughts?
The second one with passing run
looks more appropriate.
One thing worth keeping in mind is the fact that Cycle might become xstream-only internally and will make users themselves responsible for converting sources from xstreams and sinks to xstream if they choose to use another library. It's not set in stone yet, of course, but here is the thread for reference: https://github.com/cyclejs/cyclejs/issues/425
Agree with Gosha. Perhaps defaulting to xstream if !run ?
On 21 Dec 2016, at 14:56, Gosha Arinich notifications@github.com wrote:
The second one with passing run looks more appropriate.
One thing worth keeping in mind is the fact that Cycle might become xstream-only internally and will make users themselves responsible for converting sources from xstreams and sinks to xstream if they choose to use another library. It's not set in stone yet, of course, but here is the thread for reference: cyclejs/cyclejs#425 https://github.com/cyclejs/cyclejs/issues/425 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lmatteis/redux-cycle-middleware/issues/6#issuecomment-268542354, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXySWejlMvUKxUzsOiBe0aiRkCRx8CLks5rKT4YgaJpZM4LRwnR.
Interesting, does this mean that all drivers must be xstream compatible?
@goshakkk it doesn't seem like Cycle will be xstream-only: https://gitter.im/cyclejs/cyclejs?at=585bcfc496a565f844067997
Unless I misunderstood what you were trying to say.
Ah it seems that the only difference is that we won't have to use runStreamAdapter. But passing the run
is something that we'll need to do in order to support other stream libs.
Currently
createCycleMiddleware()
decides which stream library to use and it defaultsxstream-run
. It would be nice to allow users to select whichrun
method to call, hence which stream library to use - and our driver internally should support most common stream libs usingrunStreamAdapter
.