Skip to content

Instantly share code, notes, and snippets.

@AlexJWayne
Created February 28, 2012 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexJWayne/1928093 to your computer and use it in GitHub Desktop.
Save AlexJWayne/1928093 to your computer and use it in GitHub Desktop.
class @A
my_function: => alert 'my function!'
A_Function_Alias: @::my_function
usage_of_alias: =>
@A_Function_Alias()
# some other code...
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
this.A = (function() {
function A() {
this.usage_of_alias = __bind(this.usage_of_alias, this);
this.my_function = __bind(this.my_function, this);
}
A.prototype.my_function = function() {
return alert('my function!');
};
A.prototype.A_Function_Alias = A.prototype.my_function;
A.prototype.usage_of_alias = function() {
return this.A_Function_Alias();
};
return A;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment