Skip to content

Instantly share code, notes, and snippets.

@chakrit
Created March 7, 2013 09:12
Show Gist options
  • Save chakrit/5106658 to your computer and use it in GitHub Desktop.
Save chakrit/5106658 to your computer and use it in GitHub Desktop.
// Generated by CoffeeScript 1.5.0
(function() {
var Base, outsideMethod,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
outsideMethod = function(func) {
return func.call({
message: 'wrong!'
});
};
Base = (function() {
function Base() {
this.echo = __bind(this.echo, this); this.message = 'right!';
outsideMethod(this.echo);
}
Base.prototype.echo = function() {
return console.log(this.message);
};
return Base;
})();
new Base;
}).call(this);
// Generated by CoffeeScript 1.6.1
(function() {
var Base, outsideMethod,
_this = this;
outsideMethod = function(func) {
return func.call({
message: 'wrong!'
});
};
Base = (function() {
function Base() {
var _this = this;
this.message = 'right!';
outsideMethod(this.echo);
this.echo = function() {
return Base.prototype.echo.apply(_this, arguments);
};
}
Base.prototype.echo = function() {
return console.log(this.message);
};
return Base;
})();
new Base;
}).call(this);
outsideMethod = (func) ->
func.call message: 'wrong!'
class Base
constructor: ->
@message = 'right!'
outsideMethod @echo
echo: =>
console.log @message
new Base
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment