-
Notifications
You must be signed in to change notification settings - Fork 362
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
Implement #484 : hookState #485
Conversation
@bajtos @raymondfeng thoughts? |
@raymondfeng @ritch If you have any objections against |
Model.notifyObserversOf('before save', { Model: Model, instance: obj }, function(err) { | ||
Model.notifyObserversOf('before save', { | ||
Model: Model, instance: obj, hookState: hookState | ||
}, function(err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coding style: please move the context initialisation to a new line and property.
var context = ...;
Model.notifyObserversOf('before save', context, function(err) {
The same fix should be applied to all other places where the context initialization does not fit a single line.
IIRC, we are already using the style described above in other existing code, so let's keep the style consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
@bajtos reformatted and fixed - except for |
No qualms here. Just a reminder that we need an example for this. |
LGTM. |
OK, can anyone merge then please? |
I am very unhappy about this merge, since when do we prefer quick merges at the cost of code quality? The code coverage is low, the fact that the state is shared between hooks is tested only for before/after delete hooks. The technique using |
This implements #484