-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
add base event hooks methods and implement a few #720
Conversation
ReactionCore.Hooks.Events.add() ReactionCore.Hooks.Events.remove() ReactionCore.Hooks.Events.run() ReactionCore.Hooks.Events.runAsync()
@jshimko see code climate, let's clean those up. I think the naming convention works.. and will let us move |
Could we also use this for collection hooks? So we could write something like: ReactionCore.Collections.Products.after.remove(function (...) {
Hooks.Collections.run("afterRemove", ...)
}); This would make the collection hooks more testable. Spying on a hook now requires spying on private |
@jshimko, don't you think your hooks system could be separate independent package for any meteor application, not only for Reaction? |
@ramusus agree. we've already discussed, we should probably move this along with our other hooks into a reaction-hooks package |
@tdecaluwe the core hooks code doesn't actually define any hooks. It just gives you the means to do it. The example accounts hooks mentioned above ( |
Yes, I think the core hooks could be completely independent from reaction. Something like meteor-hooks? I didn't look into the code, but I suppose this project should be reusable in any meteor project. But reaction related hooks should be spreaded inside reaction-related packages, where they should belongs to. Like accounts, or PayPal or whatever.. |
@jshimko 👍 Let's merge this, and refactor in the v0.12 branch as a package. |
add base event hooks methods and implement a few
Initial WIP implementation of event hooks to be used in places that can't be reached with Collection or Method hooks.
Methods
Example usage
Now you can pass any amount of functions into that hook from anywhere else in the app
Currently available hooks