public
Created

  • Download Gist
coffee.coffee
CoffeeScript
1 2 3 4 5 6 7 8
class @A
my_function: => alert 'my function!'
 
A_Function_Alias: @::my_function
 
usage_of_alias: =>
@A_Function_Alias()
# some other code...
js.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
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;
 
})();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.