rethinkdb / horizon

Horizon is a realtime, open-source backend for JavaScript apps.
MIT License
6.78k stars 351 forks source link

Fix Cycle.js example to work with RxJS 5 #314

Open deontologician opened 8 years ago

deontologician commented 8 years ago

I think the only example that was broken by the RxJS 5 was the Cycle.js demo, since it uses Rx internally. It should be possible to port, but it might be annoying without having a preprocessor (all of the examples are currently written in vanilla js, which is definitely preferable).

The issues as I see them were that we need to patch the Observable class that Horizon uses so that it has all of the normal observable operators. Right now, we export a very minimal Observable, without patching any methods onto it. RxJS 5 allows patching these methods onto the Observable by requiring certain monkeypatching modules, (for example require('rxjs/add/operators/map');) which adds the method to the Observable as a side-effect. In vanilla js however, we don't have require (usually webpack or browserify polyfill this method), so I'll have to look into how to do that.

artisonian commented 8 years ago

Just tried the RxJS 5 versions of @cycle/rxjs-run and @cycle/dom, but it seems one of the bundles is looking for the global rxjs rather than Rx.

deontologician commented 8 years ago

Thanks for checking it out @artisonian

deontologician commented 8 years ago

Also from @artisonian on Slack:

speaking of new versions of libraries…i don’t think the Cycle.js example will work until the cycle/diversity work is done (merging RxJS 5 observable from horizon#watch() with the RxJS 4.0 from the stable @cycle/core won’t work)

HankMcCoy commented 8 years ago

I got the Cycle example working locally by just converting the Rx v5 observables from Horizon into Rx v4 observables. Let me know if that is a stop-gap measure you folks would be interested in merging and I can probably open a PR later tonight.

deontologician commented 8 years ago

This is ok, It'd be nicer if we could do it without a hack like that. I'd like to leave this issue open even if we do, since otherwise fixing it for real might slip through the cracks

On Sun, May 29, 2016, 17:15 Thomas Beirne notifications@github.com wrote:

I got the Cycle example working locally by just converting the Rx v5 observables from Horizon into Rx v4 observables. Let me know if that is a stop-gap measure you folks would be interested in merging and I can probably open a PR later tonight.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/rethinkdb/horizon/issues/314#issuecomment-222391152, or mute the thread https://github.com/notifications/unsubscribe/AAAFVqd0-O7hfYAwyHdoC0-1FXkkybIhks5qGiwpgaJpZM4IVp0U .

deontologician commented 8 years ago

Rxjs5 support released today: https://github.com/cyclejs/core/releases/tag/v7.0.0