Skip to content
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

Subscribing to data updates #82

Closed
krasnoukhov opened this issue Jan 15, 2015 · 2 comments
Closed

Subscribing to data updates #82

krasnoukhov opened this issue Jan 15, 2015 · 2 comments

Comments

@krasnoukhov
Copy link

I'm looking for an event similar to didFind but which would fire every time source received an updated object data. In my case, this happens through linked property of jsonapi response. I've tried to use didTransform event, but it does not suit me well since it contains raw data, but otherwise works with some filtering applied, which is quite dirty.

I'm not sure this is good idea at all but if you think that it's worth considering, I'd love to contribute (with a little guidance).

Thanks for a nice project though! ✨

@dgeb
Copy link
Member

dgeb commented Feb 2, 2015

@krasnoukhov sorry to delay with a response.

Monitoring the didTransform event is currently the only way to know that the contents of a source have changed. The data is represented in the didTransform event in the same normalized form used throughout Orbit. What form of event and data would you find most useful?

If you'd like an example of how this event can be monitored and translated: the Store in ember-orbit monitors this event and translates the changes for the relevant models and record arrays.

@krasnoukhov
Copy link
Author

Hey @dgeb thanks for the reply! Yeah, looks like didTransform is the solution. There was a bug in my code, linked values were not properly serialized and I mistakenly thought that that's how Orbit does things.

The only thing to mention is that I would probably like more high-level wrapper over didTransform, where I can pass existing object that I'm looking for, so only relevant updates are filtered for me.

Something like this: mySource.on("didUpdate", specificPlanetUpdatedCallback, planet)

I can implement something like that in my code, so closing the issue. If you think that this idea might be useful, please feel free to reopen so we can discuss further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants