Meteor-Community-Packages / meteor-collection-hooks

Meteor Collection Hooks
https://atmospherejs.com/matb33/collection-hooks
MIT License
657 stars 92 forks source link

Provide <collection>.{before,after}.all() #58

Closed wizonesolutions closed 10 years ago

wizonesolutions commented 10 years ago

It'd be nice to have a combo hook for before/after insert, update, or remove. My use case is that I'm synchronizing the app with Google Calendar whenever any tasks are added, updated, or removed. I don't even need to know what actually happened (the sync logic takes care of figuring all that out). It'd just save a couple lines of code, so I thought to suggest it.

matb33 commented 10 years ago

Interesting idea -- although it would need some kind of normalized API since each operation is quite different from the next, i.e. the arguments passed on to the hook would need to be provided in some sort of common way, but that would dumb it down quite a bit... I have a feeling it may be better for the user to write their own mini-wrapper that does this for their specific use case, where they are free to decide how much of the hook functionality to discard when normalizing...

wizonesolutions commented 10 years ago

Hmm...yeah, I can agree with that. I sort of thought the same.