-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move reactive functions to service(...).watch(), use rxjs5 #58
Conversation
- remove Rx as mandatory argument - service methods now remain unchanged (only return Promises) - services now have a .watch() method returning an object with service methods which return Observables. - fixed tests This accomplishes: - Service methods are not overloaded anymore and can now be typed properly (TypeScript). - Reduced bundle sizes (method imports) - Observables can be lazy while fire-and-forget functionality is maintained - Promisification of Observables could lead to unintended side effects with functions that take a Promise or an Observable as an argument (e.g. angular's async pipe). This is no longer the case.
# Conflicts: # .gitignore
import all necessary methods
- removed obsolete promisification tests - added some comments
I like it once we make sure that all the tests are passing. I'd still like to investigate if we could implement #43 because it seems like the cleanest way to deal with it to me. Maybe add a |
Tests fixed. |
Re: #43 |
add option.let to support modification of all outgoing streams
I thought it's just meant for implementing your own "Observablification"? So a normal service call even with using feathers-reactive would still return an actual promise but something like const ob = Observable.from(app.service('messages').find());
ob.subscribe(page => console.log('Messages page is', page); Would return the Observable that you currently get from calling |
I took a look at rxjs5's source: https://github.com/ReactiveX/rxjs/blob/master/src/observable/FromObservable.ts Observable.from(app.service('messages').find()) would in fact create a Imho TC39 is rather thought to provide an interface for non-trivial and rather custom Objects where the to-be-created Observable's behavior can't be infered from the type. Creating an observable from a feathers service's hook-chain for example. (Whatever that would look like) |
PS: Don't forget to document how to add methods to |
going to close and clean up |
One thing I was wondering is if we should call it |
I like passing the options in there. Params is heavily overloaded already, so i think anything that can be moved somewhere else should be.
I'd prefer .watch() though, as it's more declarative and less technical. But that's personal preference.
Am 12. Juli 2017 16:37:42 MESZ schrieb David Luecke <notifications@github.com>:
…One thing I was wondering is if we should call it `.rx()` instead of
`.watch()` and pass the `feathers-reactive` options to it
(`.rx(options)`) instead of `params.rx`. Thoughts?
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#58 (comment)
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
|
This is what I came up with:
It simply moves the argument of |
I'm just reopening this, because I didn't get around to recommitting the changes in a clean way. I'm aware that reviewing changes like this sucks and I'm sorry for that. A review would still be much appreciated. There shouldn't be too much stuff in there that's controversial functionality-wise anyway. I did some refactoring to make parts of the code more readable and understandable, also moved some stuff to utils.js. If you need parts of the commit mess to be reverted, I'm fine with doing that. I'd just really like to see this merged. In case you still want Updated the first post with a complete "what's new" list. |
This looks interesting! Hopefully can be merged soon 👍 |
@j2L4e How can I use your master already now, I've tried with git://github.com/j2L4e/feathers-reactive.git#master in my package.json, but keep getting this error when importing:
|
just npm installing from #master works, I think you're having a webpack configuration issue here |
@daffl When will this be merged with the official repo? |
Thank you again for doing this @j2L4e, sorry I took so long. Released as v0.5.0, let's see how it goes 😄 |
@j2L4e I also reverted some of the |
Also, can we add a note on how to upgrade to 0.5 to the readme? |
I see, sorry for that one. |
Includes the following changes
breaking changes
function(Rx, [options])
tofunction([options])
rxjs/add
namespace.non-breaking
shareReplay
operator. Only prevents multiple simultaneous subscriptions. When the subscription count drops to zero, the cache is cleared.service.watch({ strategy: 'never' }).find()
equalsservice.watch().find({ rx: { strategy: 'never' } })
options.let
and caching functionalitiesaccomplishments
id
by default.