We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What about using hooks in base and sub classes ? Look at this use case
var hooks = require("hooks") var _ = require('underscore') // Document definition var Document = function() {} _.extend(Document, hooks) Document.prototype.save = function () { console.log('save') } Document.pre('save', function(next) { console.log('pre:save'); next() }) // Book definition var Book = function() {} _.extend(Book, Document) _.extend(Book.prototype, Document.prototype) Book.post('save', function(next) { console.log('post:save'); next() }) // Page definition function Page() {} _.extend(Page, Document) _.extend(Page.prototype, Document.prototype) // test var page = new Page page.save()
calling page's save method will output
"pre:save" "save" "post:save"
the post handler is registered within books, but still invoked in all documents see it in action
post
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What about using hooks in base and sub classes ?
Look at this use case
calling page's save method will output
the
post
handler is registered within books, but still invoked in all documents see it in actionThe text was updated successfully, but these errors were encountered: