Last active
December 16, 2015 19:39
-
-
Save geta6/5486995 to your computer and use it in GitHub Desktop.
メソッド実行にHookさせます
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 例えば res.end なら | |
end = res.end | |
res.end = -> | |
res.end = end | |
res.emit 'end' | |
res.end.apply @, arguments | |
res.on 'end', -> | |
console.log 'triggered' | |
# 例えば console.log なら | |
log = console.log | |
console.log = -> | |
console.log = log | |
console.emit 'log' | |
console.log.apply @, arguments | |
console.on 'log', -> | |
util.print 'triggered\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment