vue-meteor-tracker
vue-meteor-tracker copied to clipboard
Suggestion: setters on meteor data
Since meteor reactive data are basically computed properties, it would be nice if they could also have setters so that they could be used natively inside v-model. e.g. It would be nice to do this:
meteor: {
optedOut: {
get() {
return Meteor.user().optedOut;
},
set(value) {
Meteor.call('setOptOut', value);
},
}
}
Instead of having to use $autorun inside computed like this:
computed: {
optedOut: {
get() {
return this.$autorun(() => Meteor.user().optedOut);
},
set(value) {
Meteor.call('setOptOut', value);
},
}
}
I know there's not much difference, but it took me a thorough reading of the documentation to learn about the $autorun function and using Meteor data without the meteor option. Whereas the getter and setter syntax seemed more natural to me and I was surprised that they weren't there when I looked for them in the docs. It would also keep all the meteor data together within the meteor block instead of split between meteor and computed.
Just a suggestion though - I'm loving this (and your other vue-meteor packages), thanks!
If you don't take this suggestion, then instead it would be good to use an example with a setter in your docs, so that users can find this functionality more easily in your docs.