Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Foo = function(){}
- Foo.prototype = {
- around: function(name, pre, post) {
- old = this[name]
- this[name] = function() {
- pre()
- old()
- post()
- }
- },
- met: function(){print("met")}
- }
- f = new Foo
- f.met()
- f.around('met', function(){print("pre")}, function(){print("post")})
- f.met()
Add Comment
Please, Sign In to add comment