Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. Foo = function(){}
  2. Foo.prototype = {
  3. around: function(name, pre, post) {
  4. old = this[name]
  5. this[name] = function() {
  6. pre()
  7. old()
  8. post()
  9. }
  10. },
  11. met: function(){print("met")}
  12. }
  13.  
  14. f = new Foo
  15. f.met()
  16. f.around('met', function(){print("pre")}, function(){print("post")})
  17. f.met()
Add Comment
Please, Sign In to add comment