Advertisement
Guest User

removeListener_methods

a guest
Nov 22nd, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Foo() {
  2.   var s = 1;
  3. }
  4.  
  5. var a;
  6. var b;
  7.  
  8. Foo.prototype.bar = function() {
  9.   if (!a)
  10.     a = this.baz.bind(this);
  11.   else if (!b)
  12.     b = this.baz.bind(this);
  13.   else
  14.     console.log('checking that baz.bind() === baz.bind(): ' + a === b);
  15. };
  16.  
  17. Foo.prototype.baz = function() {
  18.   return 1;
  19. };
  20.  
  21. var f = new Foo();
  22. f.bar();
  23. f.bar();
  24. f.bar();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement