-
Notifications
You must be signed in to change notification settings - Fork 2
add callback to syncers? #17
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
Comments
Hmmm, events could do the job. While, those developers who are already familiar with the ordinary feathers syntax might feel better if an additional callback-style interface is provided. Let's compare the two syntax: new Vue {
sync: {
item: {
service: 'xxx',
id: 'xxxx',
success: (data) => {
console.log(data)
}
}
}
} or: new Vue {
sync: {
item: {
service: 'xxx',
id: 'xxxx'
}
}
...
inSomeHooksOrMethods: {
this.$on('syncer-loaded', (path, error) => {
if (path === 'item') {
console.log(this.item)
}
}
}
} I feel the event way separates the declaration of the syncer and it's behavior apart, making it a little big hard to read, and is not that concise. |
Yeah that's way better for that use Regarding interface, I feel like |
yeah I prefer |
I understand that an
itemSyncer
is actually an automaticget
, and acollectionSyncer
is an automaticfind
, but it seems currently it lacks callback params, so we cannot do something after the authomatic get/find is done or failed.I suggest that in the
sync
option, allow users to pass in asuccess
and afailure
callback, so make the syncers can do all thingsfind
andget
can do. Just like this:Or any better names or better ways to do this?
The text was updated successfully, but these errors were encountered: