Created
May 5, 2011 22:38
-
-
Save potench/958127 to your computer and use it in GitHub Desktop.
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
var Ex = Ex || {}; | |
Ex.A = RED.Class.extend({ | |
init : function() { | |
this.resize = this.delegate(this, this.resize); // encapsulates to keep scope | |
$(window).bind('resize', this.resize); | |
$("body").bind('click', this.delegate(this,function() { | |
console.log('clicked'); | |
$(window).unbind('resize', this.resize); | |
})); | |
}, | |
resize : function(e) { | |
console.log(e); // event, event.target for DOM access | |
console.log(this); // ESPN.Page() instance | |
} | |
}); | |
var t = new Ex.A(); | |
// click the body to detach the listener |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment