ff0000/rosy — pull request #60 by gigafied (2012-08-30 00:17:31+00:00)
Title: Properly scope all methods to proper lexical `this`.

This PR makes it so that anytime you invoke a method on an instance of a Class, `this` equals what you'd expect it to.

var Something = Class.extend({

someProp : "something",

someMethod : function () {
console.log(this.someProp);
}

});

var SomethingElse = Class.extend({

someProp : "something else"

});

var instance = new Something();
var instance2 = new SomethingElse();

instance.someMethod(); // "something"

instance.someMethod.call(instance2); // "something"
instance.someMethod.call(window); // "something"
instance.someMethod.call(null); // "something"

This means that you no longer have to do things like this:

this.vars.links.on("click", this.proxy(this.onLinkClick));

Instead, you can now do this:

this.vars.links.on("click", this.onLinkClick);

If you ever need to turn this feature off:

Class.extend({
opts: {
autoProxy : false
}
});